From ed5cf4bdac69daa373474f439dc474b9f53e1b4a Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 3 Jul 2023 10:41:32 -0400
Subject: fixed making one tab always active.

---
 src/client/views/collections/TabDocView.tsx | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

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

diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index 83edc60df..f6220a6b8 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -52,8 +52,14 @@ export class TabDocView extends React.Component<TabDocViewProps> {
     @observable _isActive: boolean = false;
     @observable _isAnyChildContentActive = false;
     @computed get _isContentActive() {
-        return SelectionManager.Views().some(view => view.rootDoc === this._document) || this._isAnyChildContentActive;
+        const tabs = Array.from(CollectionDockingView.Instance?.tabMap ?? new Set());
+        return (
+            SelectionManager.Views().some(view => view.rootDoc === this._document) ||
+            this._isAnyChildContentActive ||
+            (tabs.findIndex(tab => tab.DashDoc === this._document) === 0 && !tabs.some(tab => SelectionManager.Views().some(dv => dv.rootDoc === tab.DashDoc)))
+        );
     }
+
     @observable _document: Doc | undefined;
     @observable _view: DocumentView | undefined;
 
@@ -414,11 +420,7 @@ export class TabDocView extends React.Component<TabDocViewProps> {
     tabView = () => this._view;
     disableMinimap = () => !this._document || this._document.layout !== CollectionView.LayoutString(Doc.LayoutFieldKey(this._document)) || this._document?._type_collection !== CollectionViewType.Freeform;
     whenChildContentActiveChanges = (isActive: boolean) => (this._isAnyChildContentActive = isActive);
-    tabs = () => Array.from(CollectionDockingView.Instance?.tabMap ?? new Set());
-    isContentActive = () =>
-        SelectionManager.Views().some(dv => dv.rootDoc === this._document) ||
-        this._isAnyChildContentActive ||
-        (this.tabs().findIndex(tab => tab.DashDoc === this._document) === 0 && !this.tabs().some(tab => SelectionManager.Views().some(dv => dv.rootDoc === tab.DashDoc)));
+    isContentActive = () => this._isContentActive;
     @computed get docView() {
         return !this._activated || !this._document ? null : (
             <>
-- 
cgit v1.2.3-70-g09d2

