diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2023-10-10 16:21:41 -0400 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2023-10-10 16:21:41 -0400 |
commit | 9e91e6065333f03d3f3bf2c0d43b822d85344c78 (patch) | |
tree | 4c923fc8257b597d69700bee4c1a4e69d3cbe21a /src/client/DocServer.ts | |
parent | 368e33c076085b1b73f522ac88f548a2ad081c80 (diff) | |
parent | d929c0511cae863412a398f426d9e5b7ca64e6d9 (diff) |
merge?
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r-- | src/client/DocServer.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts index 5fdea131b..353e11775 100644 --- a/src/client/DocServer.ts +++ b/src/client/DocServer.ts @@ -32,9 +32,11 @@ export namespace DocServer { let _cache: { [id: string]: RefField | Promise<Opt<RefField>> } = {}; export function FindDocByTitle(title: string) { - const foundDocId = Array.from(Object.keys(_cache)) - .filter(key => _cache[key] instanceof Doc) - .find(key => (_cache[key] as Doc).title === title); + const foundDocId = + title && + Array.from(Object.keys(_cache)) + .filter(key => _cache[key] instanceof Doc) + .find(key => (_cache[key] as Doc).title === title); return foundDocId ? (_cache[foundDocId] as Doc) : undefined; } @@ -51,6 +53,7 @@ export namespace DocServer { DocListCast(DocCast(Doc.UserDoc().myLinkDatabase).data).forEach(link => { if (!references.has(DocCast(link.link_anchor_1)) && !references.has(DocCast(link.link_anchor_2))) { Doc.RemoveDocFromList(DocCast(Doc.UserDoc().myLinkDatabase), 'data', link); + Doc.AddDocToList(Doc.MyRecentlyClosed, undefined, link); } }); LinkManager.userLinkDBs.forEach(linkDb => Doc.FindReferences(linkDb, references, undefined)); |