From a61527764cf7db2f7159730504dc70736219035d Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 21 Oct 2020 23:59:30 -0400
Subject: fixed dragging documents to bottom of presentation list.  fixed
 adding to preentation list without creatinga a duplicate.

---
 src/client/views/collections/TabDocView.tsx | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 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 9c5f7c66e..41c372faa 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -6,7 +6,7 @@ import { clamp } from 'lodash';
 import { action, computed, IReactionDisposer, observable, reaction } from "mobx";
 import { observer } from "mobx-react";
 import * as ReactDOM from 'react-dom';
-import { DataSym, Doc, DocListCast, Opt } from "../../../fields/Doc";
+import { DataSym, Doc, DocListCast, Opt, DocListCastAsync } from "../../../fields/Doc";
 import { Id } from '../../../fields/FieldSymbols';
 import { FieldId } from "../../../fields/RefField";
 import { listSpec } from '../../../fields/Schema';
@@ -144,10 +144,11 @@ export class TabDocView extends React.Component<TabDocViewProps> {
             const fieldKey = CollectionDockingView.Instance.props.fieldKey;
             const sublists = DocListCast(dview[fieldKey]);
             const tabs = Cast(sublists[0], Doc, null);
-            const tabdocs = DocListCast(tabs.data);
-            if (!tabdocs.includes(curPres)) {
-                CollectionDockingView.AddSplit(curPres, "right");
-            }
+            DocListCastAsync(tabs.data).then(tabdocs => {
+                if (!tabdocs?.includes(curPres)) {
+                    CollectionDockingView.AddSplit(curPres, "right");
+                }
+            });
             DocumentManager.Instance.jumpToDocument(doc, false, undefined);
         }
     }
-- 
cgit v1.2.3-70-g09d2

