diff options
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx')
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 12a299ce6..a14dcb592 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1401,12 +1401,12 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection return undefined; } - renderCutoffProvider = computedFn( - // eslint-disable-next-line prefer-arrow-callback - function renderCutoffProvider(this: any, doc: Doc) { - return this.Document.isTemplateDoc ? false : !this._renderCutoffData.get(doc[Id] + ''); - }.bind(this) - ); + /** + * Determines whether the passed doc should be rendered + * since rendering a large collection of documents can be slow, at startup, docs are rendered in batches. + * each doc's render() method will call the cutoff provider which will let the doc know if it should render itself yet, or wait + */ + renderCutoffProvider = computedFn((doc: Doc) => (this.Document.isTemplateDoc ? false : !this._renderCutoffData.get(doc[Id] + ''))); doEngineLayout( poolData: Map<string, PoolData>, @@ -1426,15 +1426,13 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection @computed get doInternalLayoutComputation() { TraceMobx(); const newPool = new Map<string, PoolData>(); - // prettier-ignore switch (this.layoutEngine) { case computePassLayout.name : return { newPool, computedElementData: this.doEngineLayout(newPool, computePassLayout) }; case computeTimelineLayout.name: return { newPool, computedElementData: this.doEngineLayout(newPool, computeTimelineLayout) }; case computePivotLayout.name: return { newPool, computedElementData: this.doEngineLayout(newPool, computePivotLayout) }; case computeStarburstLayout.name: return { newPool, computedElementData: this.doEngineLayout(newPool, computeStarburstLayout) }; - default: - } - return { newPool, computedElementData: this.doFreeformLayout(newPool) }; + default: return { newPool, computedElementData: this.doFreeformLayout(newPool) }; + } // prettier-ignore } @action |