WeKnora/frontend/src/stores
Claude 35a5e29a23 fix(frontend): drop infectious preference fallback, add migration latch
QA review of the previous hardening commit identified two cross-user
infection paths created by the smart-fallback read chain (CRIT-1/2),
plus a UI-desync hazard from validation guards in setters (HIGH-1).

- Extracted localStorage helpers and migration logic into
  composables/preferenceStorage.ts as a single source of truth.
- Reads now hit only the active user's namespace - no anon / legacy
  fallback in the hot path. Pre-existing values are migrated **once**
  per active user via migratePreferencesIntoUser, which adopts anon
  and legacy keys into the user namespace and then deletes the source
  keys, so a second user logging into the same browser cannot inherit
  the previous user's preferences.
- Migration latch tracks which user has already been migrated this
  session; auth store's reloadUserPreferences resets the latch on
  setUser/logout so the next active user gets a fresh migration.
- setSansFont / setMonoFont / setFontSize / setTheme now return a
  boolean; GeneralSettings.vue handlers roll the form back to the
  canonical state when validation rejects a value, preventing the
  UI from drifting out of sync with the source of truth.
- safeSetItem now console.warn on persistence failures so quota /
  private-mode issues are at least diagnosable.
- applyFont is diff-aware: only the CSS variables that actually
  changed are written to the root style, avoiding unnecessary style
  recalculation when only one knob is flipped.
- applyTheme caches the last effective mode to skip redundant
  attribute writes and Wails IPC calls.

https://claude.ai/code/session_01S1FVPf4jRfWXkTSnpMmMp7
2026-05-05 00:48:40 +08:00
..
auth.ts fix(frontend): drop infectious preference fallback, add migration latch 2026-05-05 00:48:40 +08:00
knowledge.ts feat(ui): Support multi knowledgebases operation 2025-09-17 16:02:08 +08:00
menu.ts Merge upstream main and resolve conflicts 2026-04-14 14:13:00 +08:00
organization.ts feat(api): integrate per-organization resource counts into organization listing 2026-02-09 11:40:25 +08:00
settings.ts feat: implement automatic update checking and downloading functionality in the desktop app, enhancing user experience with seamless updates and corresponding UI settings 2026-04-11 18:51:16 +08:00
ui.ts feat: enhance sidebar functionality and UI responsiveness 2026-03-05 18:14:14 +08:00