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

Dark/Light Mode always reverts to "System" on browser reload during local development #1853

Open
codeBelt opened this issue Oct 24, 2024 · 0 comments

Comments

@codeBelt
Copy link

Describe the bug

I'm experiencing an issue with the Dark/Light Mode toggle in my Next.js app (using the app directory) while developing locally. When I select "Light Mode" and then reload the browser, it resets to "System" instead of remembering my previous selection.

This behavior seems to only occur during local development; when the site is hosted on Vercel in a production build, the selection is retained as expected.

To Reproduce

  1. Start the Next.js app in development mode.
  2. Switch to "Light Mode."
  3. Reload the browser.

Expected behavior

The selected mode (e.g., "Light Mode") should persist across browser reloads.

Which versions of Sanity are you using?

@sanity/cli (global) 3.56.0 (latest: 3.62.2)
@sanity/image-url 1.0.2 (up to date)
@sanity/ui 2.8.10 (up to date)
@sanity/vision 3.62.2 (up to date)
sanity 3.62.2 (up to date)

What operating system are you using?

macOS sonoma

Which versions of Node.js / npm are you running?

10.5.0
v21.7.2

Additional context

  • I am unsure which version this change occurred in, but I distinctly remember that my selection was being remembered in the past.
  • As a side note, it would be beneficial to have an option in the Sanity config to set the default for the Dark/Light Mode.
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

No branches or pull requests

1 participant