From 9b424c94d7a89950e9cf3f72e684bd15a61e87ae Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 2 May 2024 11:19:37 -0400
Subject: another push to remove cycles by pushing things onto Doc  and
 DocumentView

---
 src/client/views/collections/CollectionDockingView.tsx | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

(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 fc9e2e39b..0ee3575f3 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -2,7 +2,7 @@ import { action, IReactionDisposer, makeObservable, observable, reaction } from
 import { observer } from 'mobx-react';
 import * as React from 'react';
 import * as ReactDOM from 'react-dom/client';
-import { addStyleSheet, addStyleSheetRule, clearStyleSheetRules, DivHeight, DivWidth, incrementTitleCopy, UpdateIcon } from '../../../ClientUtils';
+import { addStyleSheet, addStyleSheetRule, clearStyleSheetRules, DivHeight, DivWidth, incrementTitleCopy, returnTrue, UpdateIcon } from '../../../ClientUtils';
 import { Doc, DocListCast, Field, Opt } from '../../../fields/Doc';
 import { AclAdmin, AclEdit, DocData } from '../../../fields/DocSymbols';
 import { Id } from '../../../fields/FieldSymbols';
@@ -49,7 +49,8 @@ export class CollectionDockingView extends CollectionSubView() {
     private _reactionDisposer?: IReactionDisposer;
     private _lightboxReactionDisposer?: IReactionDisposer;
     private _containerRef = React.createRef<HTMLDivElement>();
-    public _flush: UndoManager.Batch | undefined;
+    private _flush: UndoManager.Batch | undefined;
+    private _unmounting = false;
     private _ignoreStateChange = '';
     public tabMap: Set<any> = new Set();
     public get HasFullScreen() {
@@ -330,6 +331,7 @@ export class CollectionDockingView extends CollectionSubView() {
     };
 
     componentDidMount: () => void = async () => {
+        this._props.setContentViewBox?.(this);
         this._unmounting = false;
         SetPropSetterCb('title', this.titleChanged); // this overrides any previously assigned callback for the property
         if (this._containerRef.current) {
@@ -366,7 +368,6 @@ export class CollectionDockingView extends CollectionSubView() {
         }
     };
 
-    _unmounting = false;
     componentWillUnmount: () => void = () => {
         this._unmounting = true;
         try {
@@ -383,6 +384,9 @@ export class CollectionDockingView extends CollectionSubView() {
         this._lightboxReactionDisposer?.();
     };
 
+    // ViewBoxInterface overrides
+    override isUnstyledView = returnTrue;
+
     @action
     onResize = () => {
         const cur = this._containerRef.current;
@@ -437,8 +441,8 @@ export class CollectionDockingView extends CollectionSubView() {
                 } else {
                     const tabTarget = (e.target as HTMLElement)?.parentElement?.className.includes('lm_tab') ? (e.target as HTMLElement).parentElement : (e.target as HTMLElement);
                     const map = Array.from(this.tabMap).find(tab => tab.element[0] === tabTarget);
-                    if (map?.DashDoc && DocumentView.getFirstDocumentView(map.DashDoc)) {
-                        DocumentView.SelectView(DocumentView.getFirstDocumentView(map.DashDoc), false);
+                    if (map?.DashDoc && DocumentView.getDocumentView(map.DashDoc, this.DocumentView?.())) {
+                        DocumentView.SelectView(DocumentView.getDocumentView(map.DashDoc, this.DocumentView?.()), false);
                     }
                 }
             }
-- 
cgit v1.2.3-70-g09d2

