nuxt-modules/i18n

Switching locale doesn't trigger `useAsyncData` on Homepage

Open

#3599 aperta il 14 mag 2025

Vedi su GitHub
 (15 commenti) (2 reazioni) (0 assegnatari)TypeScript (521 fork)github user discovery
help wantedneed discussion

Metriche repository

Star
 (2061 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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: Image 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): Image Working ✅

Logs

Guida contributor