THU-504: Local settings store#857
Conversation
Semgrep Security ScanNo security issues found. |
PR Metrics
Updated Fri, 15 May 2026 10:09:49 GMT · run #1503 |
ital0
left a comment
There was a problem hiding this comment.
Just pointed out some details I noticed.
I completetly ignore files under eval since they should be used only internally.
|
Preview environment deployed 🚀
Stack: Auto-destroys on PR close/merge. Login via the bundled Keycloak realm — |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 36983cb. Configure here.

Summary
local-settings-store.ts) for device-specific settings that shouldn't sync across devicescloud_url,debug_posthog,is_native_fetch_enabled,haptics_enabled,syncEnabled, andthemefrom the PowerSync DB / raw localStorage to the new storedefaults/settings.tsand the unusedui-themeDB settingThemeProviderto read/write via the Zustand store instead of its own localStorage keyWhy
cloud_urlcreates a bootstrap circular dependency — needed before DB init, but stored in DBis_native_fetch_enabledwas read via async DB query on every fetch request — now synchronousui-themeDB setting was dead code —ThemeProviderused its own localStoragepowersync_sync_enabledwas a scattered raw localStorage flagTest plan
cloud_urlavailable at Step 0 without DBcloudUrl(citations, tool icons, link previews) render correctlylocalStoragehasthunderbolt-local-settingskey with correct shapeNote
Medium Risk
Migrates several boot-critical settings (
cloudUrl, theme, sync enablement) away from the DB/rawlocalStorage, which can affect startup, auth redirects, and sync connectivity if defaults or persistence behavior differ.Overview
Introduces a persisted Zustand
local-settings-storefor device-specific config (cloudUrl,theme,syncEnabled, haptics, native fetch, PostHog debug) and updates callers across AI fetch/evals, auth flows (SSO redirect/sign-in), chat widgets (citations/link previews/tool icons), and PowerSync to read/write from this store instead of DB settings or ad-hoclocalStoragekeys.Refactors
ThemeProviderand the pre-paint theme script inindex.htmlto use the new persisted store shape, removes several now-dead default DB settings fromdefaults/settings.ts, and ensuresclearLocalDataresets local settings back toinitialLocalSettings. Tests are updated to seedsyncEnabledvia the store and to reuse the exportedsyncEnabledChangeEventconstant.Reviewed by Cursor Bugbot for commit 6e9b15a. Bugbot is set up for automated code reviews on this repo. Configure here.