diff options
author | bobzel <zzzman@gmail.com> | 2024-04-25 17:39:54 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-04-25 17:39:54 -0400 |
commit | fa50d38e671197ac333f99178fa3065a19ff834c (patch) | |
tree | 69b68b7487c46bfceee6edacef0016d6eb4bec3e | |
parent | d1a2cbd20a560ce1a7cd13d66cc25df2528c4244 (diff) |
minor lint cleanup
-rw-r--r-- | src/client/util/LinkManager.ts | 4 | ||||
-rw-r--r-- | src/client/views/OverlayView.tsx | 7 | ||||
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 18 |
3 files changed, 10 insertions, 19 deletions
diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts index c986bd674..6a2ac6bbb 100644 --- a/src/client/util/LinkManager.ts +++ b/src/client/util/LinkManager.ts @@ -199,9 +199,7 @@ export class LinkManager { ); }; - relatedLinker = computedFn(function relatedLinker(this: any, anchor: Doc): Doc[] { - return this.computedRelatedLinks(anchor, [anchor]); - }, true); + relatedLinker = computedFn((anchor: Doc): Doc[] => this.computedRelatedLinks(anchor, [anchor]), true); // returns map of group type to anchor's links in that group type public getRelatedGroupedLinks(anchor: Doc): Map<string, Array<Doc>> { diff --git a/src/client/views/OverlayView.tsx b/src/client/views/OverlayView.tsx index 960282a08..e1c248a7a 100644 --- a/src/client/views/OverlayView.tsx +++ b/src/client/views/OverlayView.tsx @@ -181,12 +181,7 @@ export class OverlayView extends ObservableReactComponent<{}> { return true; }; - docScreenToLocalXf = computedFn( - // eslint-disable-next-line prefer-arrow-callback - function docScreenToLocalXf(this: any, doc: Doc) { - return () => new Transform(-NumCast(doc.overlayX), -NumCast(doc.overlayY), 1); - } - ); + docScreenToLocalXf = computedFn((doc: Doc) => () => new Transform(-NumCast(doc.overlayX), -NumCast(doc.overlayY), 1)); @computed get overlayDocs() { return Doc.MyOverlayDocs.filter(d => !LightboxView.LightboxDoc || d.type === DocumentType.PRES).map(d => { 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 |