Skip to content

fix(settings-store): surface localStorage quota/security errors (closes #454) - #473

Open
EVWorth wants to merge 1 commit into
mainfrom
fix/454-settings-storage-error
Open

fix(settings-store): surface localStorage quota/security errors (closes #454)#473
EVWorth wants to merge 1 commit into
mainfrom
fix/454-settings-storage-error

Conversation

@EVWorth

@EVWorth EVWorth commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

Both setQuerySettings / setFormatterSettings wrapped localStorage.setItem in try/catch with empty catch — quota-exceeded writes (Chrome's 5 MB hard cap), Safari private mode, and disabled-storage environments all silently reverted settings to defaults on next launch.

  • Add settingsStorageError: string | null slot, populated by both setters, cleared on next successful write
  • Distinguish DOMException codes (QuotaExceededError → "clear space"; SecurityError → "private mode/cookies disabled")
  • console.warn with the original exception so dev-tools surfaces the failure path
  • 3 tests: quota, security, recovery

Files

  • src/stores/settingsStore.ts
  • src/stores/tests/settingsStore.test.ts (29/29)

Test plan

  • vitest: settingsStore 29/29
  • vitest: full frontend
  • tsc --noEmit clean
  • eslint clean

Closes #454

#454)

Both setQuerySettings and setFormatterSettings wrapped localStorage.setItem
in a try/catch with an empty catch body — quota-exceeded writes (Chrome's
5 MB hard cap), Safari private mode, and disabled-storage environments all
silently reverted user settings to defaults on next launch. No log, no
signal, no degradation flag.

- Add `settingsStorageError: string | null` slot to the store. Populated
  by both setters when persistence throws; cleared on next successful
  write.
- Distinguish DOMException codes: QuotaExceededError (suggest clearing
  space), SecurityError (private mode / cookies disabled), or generic.
- console.warn with the original exception so dev-tools surfaces the
  failure path.
- Adds 3 tests: quota path, security path, recovery path on next
  successful write.

Consumers (e.g. a future toast banner) can subscribe to the new slot to
surface a user-visible error.

Closes #454

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1][bug] settingsStore swallows localStorage.setItem quota errors silently

1 participant