Skip to content

fix(react): refresh i18n context identity for React Compiler memoization#2456

Open
yslpn wants to merge 4 commits intolingui:nextfrom
yslpn:fix/react-compiler-i18n-context-identity
Open

fix(react): refresh i18n context identity for React Compiler memoization#2456
yslpn wants to merge 4 commits intolingui:nextfrom
yslpn:fix/react-compiler-i18n-context-identity

Conversation

@yslpn
Copy link
Contributor

@yslpn yslpn commented Feb 14, 2026

Description

Recreate i18n reference in I18nProvider via Proxy so memoized React Compiler paths update on locale change.
Add a regression test for memoized useLingui().i18n locale updates.

Avoiding recreating the initial state of the context by passing a function to useState
https://react.dev/reference/react/useState#avoiding-recreating-the-initial-state

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Examples update

Fixes #2343

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Feb 14, 2026

@yslpn is attempting to deploy a commit to the Crowdin Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.66%. Comparing base (dd43fb0) to head (133db5f).
⚠️ Report is 312 commits behind head on next.

Additional details and impacted files
@@             Coverage Diff             @@
##             next    #2456       +/-   ##
===========================================
+ Coverage   76.66%   88.66%   +11.99%     
===========================================
  Files          81      117       +36     
  Lines        2083     3308     +1225     
  Branches      532      975      +443     
===========================================
+ Hits         1597     2933     +1336     
+ Misses        375      337       -38     
+ Partials      111       38       -73     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant