nuxt-modules/i18n

Switching locale doesn't trigger `useAsyncData` on Homepage

Open

#3 599 ouverte le 14 mai 2025

Voir sur GitHub
 (15 commentaires) (2 réactions) (0 assignés)TypeScript (521 forks)github user discovery
help wantedneed discussion

Métriques du dépôt

Stars
 (2 061 stars)
Métriques de merge PR
 (Métriques PR en attente)

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: 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

Guide contributeur