From 24bed97cf02df1624c813ae7e78f8d0eff62e92e Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 21 Aug 2020 20:55:05 -0400
Subject: fixed snapshoting dashboards to alias tabs

---
 src/client/views/MainView.tsx | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

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

diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 64efc5ee5..0dee9291d 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -978,11 +978,12 @@ export class MainView extends React.Component {
 Scripting.addGlobal(function selectMainMenu(doc: Doc, title: string) { MainView.Instance.selectMenu(doc); });
 Scripting.addGlobal(function toggleComicMode() { Doc.UserDoc().fontFamily = "Comic Sans MS"; Doc.UserDoc().renderStyle = Doc.UserDoc().renderStyle === "comic" ? undefined : "comic"; });
 Scripting.addGlobal(function copyDashboard() {
-    const copiedDashboard = Doc.MakeCopy(Cast(Doc.UserDoc().activeDashboard, Doc, null), true);
-    const dashboards = Cast(Doc.UserDoc().myDashboards, Doc, null);
-    Doc.AddDocToList(dashboards, "data", copiedDashboard);
-    // bcz: strangely, we need a timeout to prevent exceptions/issues initializing GoldenLayout (the rendering engine for Main Container)
-    setTimeout(() => MainView.Instance.openDashboard(copiedDashboard), 0);
+    const activeDashboard = Cast(Doc.UserDoc().activeDashboard, Doc, null);
+    CollectionDockingView.Copy(activeDashboard).then(copy => {
+        Doc.AddDocToList(Cast(Doc.UserDoc().myDashboards, Doc, null), "data", copy);
+        // bcz: strangely, we need a timeout to prevent exceptions/issues initializing GoldenLayout (the rendering engine for Main Container)
+        setTimeout(() => MainView.Instance.openDashboard(copy), 0);
+    });
 });
 Scripting.addGlobal(function importDocument() { return MainView.Instance.importDocument(); },
     "imports files from device directly into the import sidebar");
-- 
cgit v1.2.3-70-g09d2

