-
Notifications
You must be signed in to change notification settings - Fork 466
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
Comments
Thank you for your reporting!
Thanks! |
I don't think this is the expected behavior because the end state of all components is |
I have changed the logs in your reproduction to better illustrate what is happening: |
Oh, I see now. Each locale has its own instance. I also tested with lifecycle hooks and they do indeed seem to be working. Thank you for taking your time to look into this! |
Environment
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 anUnmounted
state.Please see the reproduction. When you click the
Change Locale
button, which usessetLocale
to change the locale, we see this output in console: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](https://private-user-images.githubusercontent.com/34019878/332799100-982a38cc-c50c-48e4-8400-e7e8739184b0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwNTExMDIsIm5iZiI6MTcyMDA1MDgwMiwicGF0aCI6Ii8zNDAxOTg3OC8zMzI3OTkxMDAtOTgyYTM4Y2MtYzUwYy00OGU0LTg0MDAtZTdlODczOTE4NGIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAzVDIzNTMyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdiMDg1ODgyOTZjZGE1ZDE5YWI3NDE5OTdmYzNhYjk0MDgxZTNiYjhhMWVlOGFkNDMyYTg2OTFjMjAwMzBjZDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zA57qC3jiN_6CsFbOWPQafKuPo8on2rqBff7bow7kis)
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: