nuxt-modules/i18n

Switching locale doesn't trigger `useAsyncData` on Homepage

Open

#3,599 创建于 2025年5月14日

在 GitHub 查看
 (15 评论) (2 反应) (0 负责人)TypeScript (521 fork)github user discovery
help wantedneed discussion

仓库指标

Star
 (2,061 star)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南