-
Notifications
You must be signed in to change notification settings - Fork 118
fix: prioritize config preference over stored value when not 'system' #323
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
base: main
Are you sure you want to change the base?
Conversation
This fixes an issue where explicitly configured color mode preferences (like preference: 'light') would be overridden by previously stored values from localStorage/cookies. When a user sets preference to a specific mode (not 'system'), it should take precedence over any stored preferences from previous sessions. Fixes: Color mode preference not respected when switching between projects
👷 Deploy Preview for nuxt-color-mode processing.
|
✅ Deploy Preview for nuxt-color-mode canceled.
|
- Remove trailing spaces on empty lines to fix linting error - Fixes @stylistic/no-trailing-spaces eslint rule
danielroe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem correct to me.
options.preference here is not set by the user but by you, and therefore it should never override the user's choice.
it is the 'default' preference
Line 87 in eaff67e
| * The default value of $colorMode.preference |
there's a different way to force a color mode if you need to
|
Well it's not exactly the problem, can you please look at the issue #318 so I don't have to explain all over again ? it's mainly about running 2 project in different times at the same port when one project is forced on dark and one is forced on light, it does not switch automatically and we have to clear localstorage |
|
i read it but i'm have you understood my comment? this change breaks the functionality of this module in production by changing a 'default' to an override |
|
understood but is there any other way that without breaking the functionality we can implement this ? |
|
would you spell out your desired behaviour, as clearly as possible, and addressing any edge cases or differences between how things work in production and in development? |
This fixes an issue where explicitly configured color mode preferences (like preference: 'light') would be overridden by previously stored values from localStorage/cookies.
When a user sets preference to a specific mode (not 'system'), it should take precedence over any stored preferences from previous sessions.
Fixes: Color mode preference not respected when switching between projects
🔗 Linked issue
Fixes #318
❓ Type of change