Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: defaultTheme not work when it is differrent from localstorage theme #312

Closed
shyfang opened this issue Sep 5, 2024 · 2 comments
Closed
Labels
bug Something isn't working triage

Comments

@shyfang
Copy link

shyfang commented Sep 5, 2024

What happened?

Which one has higher priority, localStorage or defaultTheme? When theme===dark in localstorage and defaultTheme====light, defaultTheme does not take effect
I need to get the custom theme from the query
first, I change the theme dark, then the localStorage theme is dark
second, https:xxx.com/?theme=light, I get the theme from query, then
<ThemeProvider defaultTheme={query.theme}>xxx</ThemeProvider>
defaultTheme not work

Version

0.3.0

What browsers are you seeing the problem on?

Chrome

@shyfang shyfang added bug Something isn't working triage labels Sep 5, 2024
@joseph0926
Copy link

const themeName = localStorage.getItem(storageKey) || defaultTheme


localstorage seems to have a higher priority

@pacocoursey
Copy link
Owner

Obviously the theme in localStorage takes precedence. The defaultTheme is just that, a defaultTheme for when another theme is not available.

@pacocoursey pacocoursey closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

3 participants