From cc3e1bc2c317cf34aba04e4935ae842b16ad4cae Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 26 Aug 2024 11:22:38 -0400
Subject: cleanup of setting myXXstuff on dashboards

---
 src/client/views/DashboardView.tsx | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

(limited to 'src/client/views/DashboardView.tsx')

diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx
index f4fc8ee9f..4616e15e5 100644
--- a/src/client/views/DashboardView.tsx
+++ b/src/client/views/DashboardView.tsx
@@ -426,16 +426,14 @@ export class DashboardView extends ObservableReactComponent<object> {
         const dashboardDoc = DashboardView.StandardCollectionDockingDocument([{ doc: freeformDoc, initialWidth: 600 }], { title: title }, id, 'row');
 
         Doc.AddDocToList(Doc.MyHeaderBar, 'data', freeformDoc, undefined, undefined, true);
+        Doc.AddDocToList(Doc.MyDashboards, 'data', dashboardDoc);
         dashboardDoc.pane_count = 1;
         freeformDoc.embedContainer = dashboardDoc;
         dashboardDoc.myOverlayDocs = new List<Doc>();
         dashboardDoc[DocData].myPublishedDocs = new List<Doc>();
         dashboardDoc[DocData].myTagCollections = new List<Doc>();
-
-        Doc.AddDocToList(Doc.MyDashboards, 'data', dashboardDoc);
-
-        DashboardView.SetupDashboardTrails(dashboardDoc);
-        DashboardView.SetupDashboardCalendars(dashboardDoc);
+        dashboardDoc[DocData].myTrails = DashboardView.SetupDashboardTrails(dashboardDoc);
+        dashboardDoc[DocData].myCalendars = DashboardView.SetupDashboardCalendars(dashboardDoc);
         // open this new dashboard
         Doc.ActiveDashboard = dashboardDoc;
         Doc.ActivePage = 'dashboard';
@@ -468,7 +466,7 @@ export class DashboardView extends ObservableReactComponent<object> {
         };
         const myCalendars = DocUtils.AssignScripts(Docs.Create.CalendarCollectionDocument([], reqdOpts));
         // { treeView_ChildDoubleClick: 'openPresentation(documentView.rootDoc)' }
-        dashboardDoc[DocData].myCalendars = new PrefetchProxy(myCalendars);
+        return new PrefetchProxy(myCalendars);
     }
 
     public static SetupDashboardTrails(dashboardDoc: Doc) {
@@ -514,12 +512,12 @@ export class DashboardView extends ObservableReactComponent<object> {
             layout_explainer: 'All of the trails that you have created will appear here.',
         };
         const myTrails = DocUtils.AssignScripts(Docs.Create.TreeDocument([], reqdOpts), { treeView_ChildDoubleClick: 'openPresentation(documentView.Document)' });
-        dashboardDoc.myTrails = new PrefetchProxy(myTrails);
 
         const contextMenuScripts = [reqdBtnScript.onClick];
         if (Cast(myTrails.contextMenuScripts, listSpec(ScriptField), null)?.length !== contextMenuScripts.length) {
             myTrails.contextMenuScripts = new List<ScriptField>(contextMenuScripts.map(script => ScriptField.MakeFunction(script)!));
         }
+        return new PrefetchProxy(myTrails);
     }
 }
 
-- 
cgit v1.2.3-70-g09d2

