Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing language unmounts the component tree #863

Closed
ChezFre opened this issue Feb 15, 2024 · 1 comment
Closed

Changing language unmounts the component tree #863

ChezFre opened this issue Feb 15, 2024 · 1 comment
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@ChezFre
Copy link

ChezFre commented Feb 15, 2024

Description

When the language is updated via router.replace(pathname, { locale }) or the Link locale prop as described in the docs the component tree gets remounted. This causes every child component to reset its internal state.

Mandatory reproduction URL

https://codesandbox.io/p/github/ChezFre/next-intl-rerender-isssue/

Reproduction description

Steps to reproduce:

  1. Click on the count button to increase the local state of the client component
  2. Click on the navigation link of the inactive page
  3. Notice that the count value has remained the same
  4. Click on the language button or link of the inactive language
  5. Notice that the count has reset to 0

Expected behaviour

Changing the language should not unmount the component tree.

@ChezFre ChezFre added bug Something isn't working unconfirmed Needs triage. labels Feb 15, 2024
@amannn
Copy link
Owner

amannn commented Feb 15, 2024

This is a duplicate of #723.

@amannn amannn closed this as completed Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants