fix(i18n): stop React Compiler freezing strings after a language switch - #1127
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Render-time i18n.t('literal') calls have no reactive inputs, so React Compiler memoizes them and they keep the previous language until the screen remounts.
Use the useTranslation t in Settings and the root stack header titles so they re-render on languageChanged.
RonenMars
force-pushed
the
fix/i18n-stale-strings-react-compiler
branch
from
September 19, 2026 22:54
ddcccf4 to
edcf2ce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After switching the app language in Settings, part of the previous language stayed on screen until the screen was left and re-opened.
"+ Добавить сервер" and "Состояние сервера" stayed Russian after switching to English and Hebrew.
React Compiler is enabled (
app.json), and it memoizesi18n.t('literal')calls in render because their only inputs are a module import and a string literal.Those strings therefore never re-rendered on
languageChanged, while strings using theuseTranslationtupdated correctly.This switches the render-time
i18n.t(...)calls inapp/settings.tsxand the root stack header titles inapp/_layout.tsxto the hook'st.The
useTranslationnamespace lists are widened to includeserversandfeedback.i18n.tcalls inside event handlers and the error-boundary classes are unchanged, since they read the language at call time and are not compiled.Checks
tscandeslintare clean on both files.npm run test:i18npasses.__tests__/e2e/settings-flow.test.tsxpasses alone (22/22); it timed out once in a batch run, which is the known load artifact.Not yet verified