feat(web): add appearance setting (follow system / dark / light) - #253
Merged
Conversation
Add user-facing appearance preference to the settings page, allowing users to choose between Follow System, Dark, and Light themes. The preference is persisted to localStorage and takes priority over automatic detection in the existing theme pipeline.
There was a problem hiding this comment.
Findings
- [Minor] Cross-tab appearance change does not update theme — storage handler updates state only, so
data-themeanduseThemesubscribers stay stale until another event fires, evidenceweb/src/hooks/useTheme.ts:133
Suggested fix:const onStorage = (event: StorageEvent) => { if (event.key !== APPEARANCE_KEY) return setAppearanceState(parseAppearance(event.newValue)) updateScheme() }
Summary
- One minor sync bug; otherwise ok. Residual risk: cross-tab theme mismatch.
Testing
- Not run (automation)
There was a problem hiding this comment.
Findings
- [Minor] Cross-tab appearance change does not update theme — storage handler updates state only, so
data-themeanduseThemesubscribers stay stale until another event fires, evidenceweb/src/hooks/useTheme.ts:133
Suggested fix:const onStorage = (event: StorageEvent) => { if (event.key !== APPEARANCE_KEY) return setAppearanceState(parseAppearance(event.newValue)) updateScheme() }
Summary
- One minor sync bug; otherwise ok. Residual risk: cross-tab theme mismatch.
Testing
- Not run (automation)
There was a problem hiding this comment.
Findings
- [Minor] Cross-tab appearance change does not update theme — storage handler updates state only, so
data-themeanduseThemesubscribers stay stale until another event fires, evidenceweb/src/hooks/useTheme.ts:133
Suggested fix:const onStorage = (event: StorageEvent) => { if (event.key !== APPEARANCE_KEY) return setAppearanceState(parseAppearance(event.newValue)) updateScheme() }
Summary
- One minor sync bug; otherwise ok. Residual risk: cross-tab theme mismatch.
Testing
- Not run (automation)
The storage event handler only updated React state without calling updateScheme(), leaving data-theme and useTheme subscribers stale.
Owner
|
@tiann review again |
|
Reviewed again. One remaining issue:
Testing: not run here; HAPI Bot |
The storage event listener was inside useAppearance(), which is only mounted on the settings page. Other pages never received cross-tab theme updates. Move the listener into initializeTheme() so all pages respond to appearance changes from other tabs.
Contributor
Author
Owner
|
@tiann review |
|
Reviewed again. I don't see a remaining concrete issue in this patch set.
Testing: not run here because HAPI Bot |
jasonczc
pushed a commit
to jasonczc/haqi
that referenced
this pull request
Mar 15, 2026
…nn#253) * feat(web): add appearance setting (follow system / dark / light) Add user-facing appearance preference to the settings page, allowing users to choose between Follow System, Dark, and Light themes. The preference is persisted to localStorage and takes priority over automatic detection in the existing theme pipeline. * fix(web): update theme on cross-tab appearance change The storage event handler only updated React state without calling updateScheme(), leaving data-theme and useTheme subscribers stale. * fix(web): move cross-tab appearance sync to global initializeTheme The storage event listener was inside useAppearance(), which is only mounted on the settings page. Other pages never received cross-tab theme updates. Move the listener into initializeTheme() so all pages respond to appearance changes from other tabs. (cherry picked from commit a0c35bc)
SeeFlowerX
pushed a commit
to SeeFlowerX/hapi
that referenced
this pull request
Apr 1, 2026
…nn#253) * feat(web): add appearance setting (follow system / dark / light) Add user-facing appearance preference to the settings page, allowing users to choose between Follow System, Dark, and Light themes. The preference is persisted to localStorage and takes priority over automatic detection in the existing theme pipeline. * fix(web): update theme on cross-tab appearance change The storage event handler only updated React state without calling updateScheme(), leaving data-theme and useTheme subscribers stale. * fix(web): move cross-tab appearance sync to global initializeTheme The storage event listener was inside useAppearance(), which is only mounted on the settings page. Other pages never received cross-tab theme updates. Move the listener into initializeTheme() so all pages respond to appearance changes from other tabs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Test plan
bun run test)