aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-05-17 18:45:01 -0400
committerbobzel <zzzman@gmail.com>2021-05-17 18:45:01 -0400
commit7c18243dd38656b63334f48d9270d912ce6384fa (patch)
tree33a11aad91cb1d9af99f9b23fa2874096e176d56
parent2e76877dc1c9c5b1c226f5bd0394d17cabfec0b4 (diff)
fixes for offscreen tabs
-rw-r--r--src/client/util/CurrentUserUtils.ts25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 6fdf649a4..a8327ae93 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -1187,8 +1187,8 @@ export class CurrentUserUtils {
const freeformDoc = CurrentUserUtils.GuestTarget || Docs.Create.FreeformDocument([], freeformOptions);
const dashboardDoc = Docs.Create.StandardCollectionDockingDocument([{ doc: freeformDoc, initialWidth: 600 }], { title: `Dashboard ${dashboardCount}` }, id, "row"); // add isFolder:true here?
freeformDoc.context = dashboardDoc;
-
- DocListCast(dashboardDoc.data)[1].data = ComputedField.MakeFunction(`dynamicOffScreenDocs(dashboardDoc)`, { dashboardDoc: Doc.name }, { dashboardDoc }) as any;
+ DocListCast(dashboardDoc.data).forEach(doc => doc.dashboard = dashboardDoc);
+ DocListCast(dashboardDoc.data)[1].data = ComputedField.MakeFunction(`dynamicOffScreenDocs(self.dashboard)`) as any;
Doc.AddDocToList(myPresentations, "data", presentation);
userDoc.activePresentation = presentation;
@@ -1267,13 +1267,16 @@ Scripting.addGlobal(function addToDashboards(dashboard: Doc) {
"adds Dashboard to set of Dashboards");
Scripting.addGlobal(function dynamicOffScreenDocs(dashboard: Doc) {
- const allDocs = DocListCast(dashboard[DataSym]["data-all"]);
- console.log(allDocs);
- const onScreenTab = DocListCast(dashboard.data)[0];
- const onScreenDocs = DocListCast(onScreenTab.data);
- return allDocs.reduce((result: Doc[], doc) => {
- !onScreenDocs.includes(doc) && (result.push(doc));
- // console.log(doc);
- return result;
- }, []);
+ if (dashboard[DataSym] instanceof Doc) {
+ const allDocs = DocListCast(dashboard[DataSym]["data-all"]);
+ console.log(allDocs);
+ const onScreenTab = DocListCast(dashboard.data)[0];
+ const onScreenDocs = DocListCast(onScreenTab.data);
+ return new List<Doc>(allDocs.reduce((result: Doc[], doc) => {
+ !onScreenDocs.includes(doc) && (result.push(doc));
+ // console.log(doc);
+ return result;
+ }, []));
+ }
+ return [];
});