diff options
author | bobzel <zzzman@gmail.com> | 2022-12-07 22:13:36 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-12-07 22:13:36 -0500 |
commit | 7b1f6b52c7b6d5750421748465d2d578a14d0f6c (patch) | |
tree | c56251d43d27d37ccea9fe8023db5a20424989fb /src | |
parent | 3f0c5011cb8ad5d41303d456f5a15563fb681193 (diff) |
simplify update cache
Diffstat (limited to 'src')
-rw-r--r-- | src/client/DocServer.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts index 5a34fcf11..e61de86be 100644 --- a/src/client/DocServer.ts +++ b/src/client/DocServer.ts @@ -29,12 +29,14 @@ export namespace DocServer { let _cache: { [id: string]: RefField | Promise<Opt<RefField>> } = {}; export function UPDATE_SERVER_CACHE(print: boolean = false) { - const strings: string[] = []; - Array.from(Object.keys(_cache)).forEach(key => { - const doc = _cache[key]; - if (doc instanceof Doc) strings.push(StrCast(doc.author) + ' ' + StrCast(doc.title) + ' ' + StrCast(Doc.GetT(doc, 'title', 'string', true))); - }); - print && strings.sort().forEach((str, i) => console.log(i.toString() + ' ' + str)); + if (print) { + const strings: string[] = []; + Array.from(Object.keys(_cache)).forEach(key => { + const doc = _cache[key]; + if (doc instanceof Doc) strings.push(StrCast(doc.author) + ' ' + StrCast(doc.title) + ' ' + StrCast(Doc.GetT(doc, 'title', 'string', true))); + }); + strings.sort().forEach((str, i) => console.log(i.toString() + ' ' + str)); + } rp.post(Utils.prepend('/setCacheDocumentIds'), { body: { cacheDocumentIds: Array.from(Object.keys(_cache)).join(';'), |