Links, Wikipedia and the replica: duplicates merged, dead fields and caches out

- One failure(res) in api.ts for every fetch that can fail (session,
  remote and the libraries calls each had their own; the error's
  attached body was never read). Session's lost() and vanished() were
  the same but for the hook: stop("foreign" | "gone").
- linker: place() locates the words with locate() instead of a copy;
  the scan reply's type is written once; LinkRow.at was never read; the
  "import" origin is never passed.
- wiki.ts: cleanHtml's cache could never hit (its only caller,
  articleText, is cached on the same key and evicts the same way);
  known() returned an article nobody read.
- Gone: currentLibrary and idbKeys (no callers), useWikiSuggest's q,
  a node's link flag spelled out where isLink says it. Exports used only
  in their own file are not exported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-17 16:25:27 -05:00
1 parent 3aa8778427
commit 52cb7c2065
11 files changed
+58 -99

No files matched your search

+2 -2
View File
@@ -74,7 +74,7 @@ export const kidClass = (key: string) => {
return `k${h.toString(36)}`;
};
/** Whether two panes show the same thing (a node, or an article or one of its sections). */
export const sameRef = (a: PaneRef, b: PaneRef): boolean =>
const sameRef = (a: PaneRef, b: PaneRef): boolean =>
a.kind === b.kind && (a.kind === "node" ? a.id === (b as { id: NodeId }).id : a.title === (b as { title: string }).title && a.sec === (b as { sec?: number }).sec);
/** What a pane shows, as a key: `n:<node id>`, or `w:<title>` with `#<section>`. A link's target has the same key as the pane it opens. */
export const refKey = (p: PaneRef): string => (p.kind === "node" ? `n:${p.id}` : `w:${p.title}${p.sec !== undefined ? `#${p.sec}` : ""}`);
@@ -1208,7 +1208,7 @@ class Store {
gone: () => this.libraryGone(),
message: (msg) => {
if (msg.linkJob) this.jobUpdate(msg.linkJob as JobState);
if (msg.library === "deleted") this.session.vanished();
if (msg.library === "deleted") this.session.stop("gone");
},
});
await this.session.load((state?.branches ?? []).map((b) => b.name), this.online);