Skip to content

fix: persist dark/light theme preference per user (#69) - #70

Merged
thermcampos merged 1 commit into
mainfrom
fix/dark-light-theme-memory
Aug 31, 2026
Merged

thermcampos merged 1 commit into
mainfrom
fix/dark-light-theme-memory

Conversation

@thermcampos

Copy link
Copy Markdown
Owner

Closes #69.

Summary

  • The theme toggle was stored only in browser localStorage, so the preference was lost across browsers/devices and could drift after reloads. The choice is now persisted on the user record: a new nullable theme column (NULL treated as light), exposed on GET /rest/users/me and writable via PATCH /rest/users with strict light/dark validation (invalid values get a 400).
  • The client keeps localStorage as a fast local cache so the theme paints immediately, then syncs from the server on login, session restore, and periodic refresh. A pending marker retries failed saves silently on the next sync instead of reverting the UI; signed-out behavior stays local-only, and logout leaves the theme untouched.
  • Also fixes the browser router being recreated on every App render, which remounted the whole route tree (losing scroll position and unsaved form input) on each theme toggle.

💘 Generated with Crush

@thermcampos thermcampos linked an issue Aug 31, 2026 that may be closed by this pull request
9 tasks
@thermcampos
thermcampos merged commit 11607b7 into main Aug 31, 2026
2 checks passed
@thermcampos
thermcampos deleted the fix/dark-light-theme-memory branch August 31, 2026 18:24
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.

Persist dark/light theme preference per user

1 participant