poli0981andClaude Opus 5 f897a711bd feat(settings): the #settings tab, header controls, and a save path that tells the truth
Six rows per docs/06 §3.4 as amended -- the doc drew five, but Settings has
carried markdownStyle since Phase 3 and #export was the only place to change
it, so it never actually persisted. Plus the header language/theme controls
from the docs/06 §3 layout, which have been missing since Phase 0.

Three defects in the store had to be fixed for any of this to work, and none
of them could fail before, because updateSettings and resetSettings had zero
callers in src/:

- writeSettings handed the Svelte $state proxy to chrome.storage.local.set,
  which structured-clones its argument. Proxies are not cloneable, so every
  save would have thrown DataCloneError in a real browser. fakeBrowser stores
  the reference without cloning, which is why 338 green tests never saw it;
  the new test clones explicitly to reproduce Chrome.
- updateSettings replaced the settings object rather than mutating it, so any
  component capturing getSettings() into a local would silently stop updating.
  Four new components read this store. Now in-place, with an identity test.
- resetSettings left the pending debounce running, so a reset within 200 ms of
  a change wrote twice -- the first write persisting values just discarded.

updateSettings now returns a SaveOutcome that resolves when the write settles
and never rejects, so the "Saved" toast reports what happened instead of
assuming. flushSettings on visibilitychange shrinks the loss window from
200 ms to roughly nothing; the comment is explicit that it does not reach zero.

Both entrypoints now await settings before mount() and drop the unguarded
browser.i18n.getUILanguage() call at module scope, which could blank the page
on a throw. Awaiting means the pre-load frame is an empty #app rather than
content painted in the wrong locale and theme. Verified top-level await
survives wxt build.

Also gates the footer nav on isWriting(): navigating away during `attesting`
unmounts ImportTab and strands its attestation resolver, deadlocking the
import until reload. TabBar already guarded this; the footer was the way
around it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 12:50:25 +07:00
2026-07-25 19:21:07 +07:00
S
Description
No description provided
GPL-3.0
3 MiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 75.8%
Svelte 14.5%
JavaScript 9.2%
CSS 0.4%