nuxt-modules/i18n
View on GitHubSwitching locale doesn't trigger `useAsyncData` on Homepage
Open
#3,599 opened on May 14, 2025
help wantedneed discussion
Repository metrics
- Stars
- (2,074 stars)
- PR merge metrics
- (Avg merge 6d 10h) (74 merged PRs in 30d)
Description
Environment
- Operating System: Darwin
- Node Version: v20.18.0
- Nuxt Version: 3.17.1
- CLI Version: 3.25.1
- Nitro Version: 2.11.12
- Package Manager: pnpm@9.12.2
- Builder: -
- User Config: modules, $development, devtools, app, css, runtimeConfig, routeRules, future, compatibilityDate, vite, postcss, eslint, i18n, image, prismic, scripts
- Runtime Modules: @nuxt/eslint@1.3.1, @nuxtjs/prismic@4.1.0, @nuxt/fonts@0.11.2, @nuxtjs/i18n@9.5.4, @nuxt/image@1.10.0, @vueuse/nuxt@13.1.0, @hebilicious/vue-query-nuxt@0.3.0, @nuxt/scripts@0.11.6
- Build Modules: -
Reproduction
https://github.com/capitalenumerique/interfaceqc
Describe the bug
On my homepage, I have some static and dynamic text.
When I change locale, the static text is updated, but not the dynamic text.
Seems like my useAsyncData is not triggered on locale change.
This ONLY happens on my homepage
On the Home page:
Not working ⛔
The website: https://interfaceqc.com/en The repo: https://github.com/capitalenumerique/interfaceqc/blob/main/app/pages/index.vue The query:
const { data: page } = await useAsyncData('home', () => {
return prismic.client.getSingle('home', {
graphQuery: `{ ...truncated... }`,
lang: `${locale.value}-ca`,
});
});
Additional context
On the FAQ page (or any other page):
Working ✅
Logs