Skip to content

TT-6225 fix: re-render UI when language changes a second time#363

Draft
nabalone wants to merge 1 commit into
developfrom
TT-6225_ui-language-change-requires-refresh
Draft

TT-6225 fix: re-render UI when language changes a second time#363
nabalone wants to merge 1 commit into
developfrom
TT-6225_ui-language-change-requires-refresh

Conversation

@nabalone

Copy link
Copy Markdown
Collaborator

Summary

Fixes TT-6225: a second UI language change (e.g. French → English) didn't take effect until a manual page refresh (F5), and in some versions caused a React #301 crash on refresh.

The localized strings are stored in redux as react-localization LocalizedStrings instances. Switching language only flips state.strings.lang; the per-layout instances are mutated in place via setLanguage, so their object reference never changes. As a result useSelector (which compares by reference / shallowEqual) saw "no change" and skipped the re-render, leaving stale labels on screen.

The localStrings selector now returns a fresh, prototype-preserving snapshot keyed on (source, language). The snapshot keeps the LocalizedStrings prototype (so getString/formatString still work) but has a new identity, so consumers re-render exactly when the displayed strings change. One snapshot is cached per layout to keep references stable between renders for the same language, avoiding spurious re-renders for consumers that don't use shallowEqual.

Test plan

  • Change UI language English → French; confirm UI updates immediately.
  • Open a project, return to the team page, then change French → English; confirm the UI updates immediately without a page refresh.
  • Confirm no React TT-7308 Refactor scope handling and triming spaces from meta data items. #301 crash occurs after switching back and refreshing.
  • Verify profile page shows the correct selected language throughout.

🤖 Generated with Claude Code

The localized strings live as react-localization LocalizedStrings instances
that are mutated in place by setLanguage, so their reference never changes on
a language switch and useSelector skips the re-render, leaving stale labels
until a page refresh. The localStrings selector now returns a fresh,
prototype-preserving snapshot keyed on (source, language), giving consumers a
new identity exactly when the displayed strings change while caching one
snapshot per layout to keep references stable between renders.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nabalone nabalone marked this pull request as draft June 17, 2026 14:42
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