nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.71k stars 478 forks source link

Incorrect translations flash when using different domains with `swr` route rules #2928

Open CernyMatej opened 5 months ago

CernyMatej commented 5 months ago

Environment

Reproduction

https://stackblitz.com/edit/github-xumxf5?file=app.vue,nuxt.config.ts,pages%2Findex.vue,package.json

Please note that this will not work on stackblitz because of the custom urls, you need to clone it locally.

Describe the bug

When using different domains in combination with an swr route rule, as shown below:

routeRules: {
    '/': { swr: 60 }
},

and disabling the route prefix by setting domainDefault: true in the locale objects, only the default translation is cached. This results in a flicker upon the first load when displaying other locales.

I'm unsure whether this issue can be addressed within this module or if it requires upstream support from Nitro. Nevertheless, adding a warning to the documentation would be nice to prevent others from spending hours on debugging this as I did 😅

I'd be happy to update the docs if needed.

Additional context

No response

Logs

No response

man-andy commented 3 weeks ago

Little bump. We have this problem as well.

man-andy commented 2 weeks ago

@kazupon is this a i18n bug or maybe a Nuxt bug?