Skip to content

Conversation

@kudzu2019
Copy link

Set the path of the cookie to the root directory , path=/

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • [√ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

When using @nuxtjs/i18n with strategy: 'prefix_and_default'β€”so that URLs include a language prefix, including for the default localeβ€”and configuring @nuxtjs/color-mode to use cookie-based storage, the following issues occur upon switching language:

  • A new color-mode cookie gets created under the current locale path (e.g., /fr)

  • The cookie resets to its default value, trouncing the user’s previously selected color mode

Expected behavior:

  • The user’s theme preference should persist across language changes

  • The color-mode cookie should be scoped to the root path (/), not confined to locale-specific subpaths

Steps to reproduce:

  1. Set @nuxtjs/i18n with strategy: 'prefix_and_default'

  2. Configure @nuxtjs/color-mode to store preference via cookie

  3. Visit the site, switch to dark mode, and inspect the cookie’s scope in dev tools

  4. Switch language and observe the creation of a locale-scoped cookie, with the preference reset

Set the path of the cookie to the root directory , path=/
@netlify
Copy link

netlify bot commented Aug 10, 2025

βœ… Deploy Preview for nuxt-color-mode canceled.

Name Link
πŸ”¨ Latest commit 313b9b1
πŸ” Latest deploy log https://app.netlify.com/projects/nuxt-color-mode/deploys/6898d0bec4a8a100088d5eb9

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.

1 participant