From 99ce76f0f21b48d8186e6aba1a0e64c87b2c0649 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 14 Feb 2022 13:44:47 -0500
Subject: added an incremental load for freeform collections.  fixed updating
 of web page thumbs on deselection after the first thumb is generated.

---
 .../collections/collectionFreeForm/CollectionFreeFormView.tsx     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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

diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index aeda71d01..2df053c50 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1300,6 +1300,7 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
         return { newPool, computedElementData: this.doFreeformLayout(newPool) };
     }
 
+    @observable numLoaded = 0;
     get doLayoutComputation() {
         const { newPool, computedElementData } = this.doInternalLayoutComputation;
         const array = Array.from(newPool.entries());
@@ -1558,8 +1559,13 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
     }
 
     children = () => {
+        this.numLoaded < this.views.length && setTimeout(action(() => this.numLoaded += 10), 500);
         const children = typeof this.props.children === "function" ? (this.props.children as any)() as JSX.Element[] : [];
-        return [...children, ...this.views, <CollectionFreeFormRemoteCursors {...this.props} key="remoteCursors" />];
+        return [
+            ...children,
+            ...this.views.slice(0, Math.min(this.views.length, this.numLoaded + 10)),
+            <CollectionFreeFormRemoteCursors {...this.props} key="remoteCursors" />
+        ];
     }
 
     chooseGridSpace = (gridSpace: number): number => {
-- 
cgit v1.2.3-70-g09d2

