From cf333a2119629f4172efef3dee08b40776cc660b Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 27 Dec 2023 15:25:45 -0500
Subject: fixed switching dashboards.

---
 src/client/views/collections/CollectionDockingView.tsx | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src/client/views/collections/CollectionDockingView.tsx')

diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index a9474fe93..75c178136 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -276,6 +276,7 @@ export class CollectionDockingView extends CollectionSubView() {
         return true;
     }
     setupGoldenLayout = async () => {
+        if (this._unmounting) return;
         //const config = StrCast(this._props.Document.dockingConfig, JSON.stringify(DashboardView.resetDashboard(this._props.Document)));
         const config = StrCast(this._props.Document.dockingConfig);
         if (config) {
@@ -313,6 +314,7 @@ export class CollectionDockingView extends CollectionSubView() {
     };
 
     componentDidMount: () => void = async () => {
+        this._unmounting = false;
         if (this._containerRef.current) {
             this._lightboxReactionDisposer = reaction(
                 () => LightboxView.LightboxDoc,
@@ -347,7 +349,9 @@ export class CollectionDockingView extends CollectionSubView() {
         }
     };
 
+    _unmounting = false;
     componentWillUnmount: () => void = () => {
+        this._unmounting = true;
         try {
             this._goldenLayout.unbind('stackCreated', this.stackCreated);
             this._goldenLayout.unbind('tabDestroyed', this.tabDestroyed);
-- 
cgit v1.2.3-70-g09d2

