nuxt-modules / i18n

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

bfcache Issue after adding i18n module #2876

Closed BrocksiNet closed 4 days ago

BrocksiNet commented 6 months ago

Environment

Reproduction

https://stackblitz.com/edit/github-jjkr5f

Describe the bug

image

I was researching a lot today about that issue. :mag:

I assume that the issue comes from nuxt i18n module.

So I created a empty nuxt/vite project with that command: pnpm dlx nuxi@latest init <project-name>

Testing this in preview mode is important because Vite is opening a WebSocket in dev mode, which can also cause an issue with bfcache.

So the steps for testing are:

  1. pnpm build
  2. pnpm preview
  3. Open the Page in a Chrome Browser
  4. Open Dev Tools -> Application -> Back/Forward Cache -> Click on Test Button

Result:

Somehow I assume it has something to do with detectBrowserLanguage function. But not sure about that. :confused:

Can someone reproduce or confirm? I hope I am wrong.

Additional context

No response

Logs

No response

BobbieGoede commented 6 months ago

This seems to be caused by useCookie provided by Nuxt (which is used by @nuxtjs/i18n), I modified your reproduction to demonstrate here.

I recommend opening an issue on the Nuxt repo as there isn't much we can do about this here.

BrocksiNet commented 6 months ago

But what about this PR in nuxt repo. It should fix that problem?

FlorianWerndl commented 5 months ago

I tried disabeling detectBrowserLanguage but problem seems to persist.

FlorianWerndl commented 4 months ago

@BrocksiNet have you found any workaround?

bbauti commented 1 month ago

Hello! Any workaround for this?

BobbieGoede commented 1 month ago

@bbauti Can you provide an up to date reproduction? I'll take a look

BobbieGoede commented 4 days ago

Closing this as I'm no longer able to reproduce this issue, perhaps it has been resolved upstream 🤔 Please let me know if you're still experiencing this issue with updated dependency, if you can provide an updated reproduction I'll reopen this issue 🙏