Open rvfakie opened 4 weeks ago
Darwin
v20.11.1
3.13.2
3.15.0
2.9.7
npm@10.2.4
-
default
@nuxtjs/i18n@8.5.5
@pinia/nuxt@0.6.0
https://stackblitz.com/edit/github-paob67?file=plugins%2Finit.ts but for some reason stackblitz not setting cookie when using setLocale from useI18n;
When calling window.location.reload() immediately in callback in nuxtApp.hook('i18n:localeSwitched'), cookie and current language resets to a previous value.
nuxtApp.hook('i18n:localeSwitched', () => window.location.reload());
But if you wrap reload in setTimeout it works as expected
nuxtApp.hook('i18n:localeSwitched', () => { setTimeout(() => window.location.reload(), 100); });
If this hook is async we should probably wait for it and then execute our callback?
No response
Environment
Darwin
v20.11.1
3.13.2
3.15.0
2.9.7
npm@10.2.4
-
default
@nuxtjs/i18n@8.5.5
,@pinia/nuxt@0.6.0
-
Reproduction
https://stackblitz.com/edit/github-paob67?file=plugins%2Finit.ts but for some reason stackblitz not setting cookie when using setLocale from useI18n;
Describe the bug
When calling window.location.reload() immediately in callback in nuxtApp.hook('i18n:localeSwitched'), cookie and current language resets to a previous value.
But if you wrap reload in setTimeout it works as expected
Additional context
If this hook is async we should probably wait for it and then execute our callback?
Logs
No response