From 1b45d2610576ded9fc0c6ca9dbb64cf06b3db1e1 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 6 Dec 2023 23:41:11 -0500 Subject: from last cleanup --- src/client/util/LinkManager.ts | 4 ++-- .../views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts index 608184596..3e98ea379 100644 --- a/src/client/util/LinkManager.ts +++ b/src/client/util/LinkManager.ts @@ -163,8 +163,8 @@ export class LinkManager { public getAllRelatedLinks(anchor: Doc) { return this.relatedLinker(anchor); } // finds all links that contain the given anchor - public getAllDirectLinks(anchor: Doc): Doc[] { - return Array.from(Doc.GetProto(anchor)[DirectLinks]); + public getAllDirectLinks(anchor?: Doc): Doc[] { + return anchor ? Array.from(Doc.GetProto(anchor)[DirectLinks]) : []; } // finds all links that contain the given anchor relatedLinker = computedFn(function relatedLinker(this: any, anchor: Doc): Doc[] { diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx index a54ee4b2c..57d2b7ba1 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx @@ -60,7 +60,7 @@ export class CollectionFreeFormInfoUI extends React.Component this.first_doc && LinkManager.Instance.getAllDirectLinks(this.first_doc), + events: () => LinkManager.Instance.getAllDirectLinks(this.first_doc), actions: links => links?.length && (this.currState = this.state3), }, { @@ -77,7 +77,7 @@ export class CollectionFreeFormInfoUI extends React.Component this.first_doc && LinkManager.Instance.getAllDirectLinks(this.first_doc), + events: () => LinkManager.Instance.getAllDirectLinks(this.first_doc), actions: links => links?.length === 0 && (this.currState = this.state2), }, { -- cgit v1.2.3-70-g09d2