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

Changing locale causes all components to be in Unmounted state #2951

Open
martinszeltins opened this issue May 22, 2024 · 0 comments
Open

Changing locale causes all components to be in Unmounted state #2951

martinszeltins opened this issue May 22, 2024 · 0 comments

Comments

@martinszeltins
Copy link

martinszeltins commented May 22, 2024

Environment

------------------------------
- Operating System: Linux
- Node Version:     v20.11.0
- Nuxt Version:     3.11.2
- CLI Version:      3.11.1
- Nitro Version:    2.9.6
- Package Manager:  npm@10.2.4
- Builder:          -
- User Config:      modules, i18n
- Runtime Modules:  @nuxtjs/i18n@8.3.1
- Build Modules:    -
------------------------------

Reproduction

https://stackblitz.com/github/martinszeltins/nuxt-i18n-unmounted

Describe the bug

When using setLocale() to change locale, it causes all of the components to be left in an Unmounted state.

Please see the reproduction. When you click the Change Locale button, which uses setLocale to change the locale, we see this output in console:

onMounted
onMounted
onUnmounted
onUnmounted

The last lifecycle hook that triggered was the onUnmounted hook. Now all components think that they are unmounted when actually they are not unmounted.

This causes all kinds of issues because usually in onUnmounted hook we perform cleanup, remove event listeners etc. and it causes the app to break.

Screenshot:
image

Additional context

No response

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant