Repository navigation
fix: follow the language switch in pop-out and history-entry labels - #47878
winnythedev wants to merge 1 commit into
Conversation
A core page's pop-out window title and the label on the current history entry are read with i18nT(), which subscribes to nothing, and handed to an effect through its dependency list. A store-driven re-render that lands between the language switch and LanguageProvider's repaint bails out: it keeps the new dependency values but drops the effect, so the repaint finds nothing changed and the old language stays. AppPopoutFrame and ShellTabTitle now call useLanguageGeneration(), as open PR #47852 does for the Files tree, so the switch itself re-renders them. A test for each switches the language with no repaint and expects the new label. Fixes #47843
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: both components now subscribe to the language switch, the same per-component pattern as #47852, and no rendered surface or contract changes. [DESIGN-REVIEWED] 26a6045 Description read[DESCRIPTION-READ] fb7c7d4077dc23adefa8831b9b3e1a68a036b017f5a32ed66659eb6f6a3befc0 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The diff adds no control, string or layout. It only adds a hook call so the existing window title and history-entry label update when the language changes. There is no new surface to screenshot. [UX-REVIEWED] 26a6045 Description read[DESCRIPTION-READ] 8108075dddd5d3a360dabc5b3a8d4ac854c58871caee19fe379f2822872ea75c That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This reuses the existing Notes
What this change shipsInventory (3 items) — 2 justifiedIntent: after a language switch, the pop-out window title and the current history entry label show the new language. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 26a6045 Description read[DESCRIPTION-READ] 9bc4289f2858a40c089b3b0b55b9ba8f89c8fea8e312a0d42e99d3abaf39b0de That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Problem / Motivation
Goal: After a dashboard language switch, a core page's pop-out window title and the label on the current history entry always show the new language.
AppPopoutFrame(shownLabel) andShellTabTitleinappShell.tsx(historyLabel, and the tab title next to it) read a translated label withi18nT(), which subscribes to nothing, and hand it to auseEffectthrough its dependency list. They rely onLanguageProvider'scloneElementrepaint to render them again. When a store-driven re-render of the same component lands between the switch and that repaint and changes nothing React tracks, React bails out of it: the render's hook state, with the effect's new dependency values, is kept, but the effect is dropped. The repaint then finds the dependencies unchanged, so the window title and the history entry stay in the old language until something else renders them. It is rare in a browser, because it needs a pending re-render at the moment of the switch.Why it matters
A person who switches language sees the pop-out window's title (taskbar and window switcher) and the Back/Forward history menu entry still in the language they left, with nothing they can do to fix it short of navigating or reloading.
Not a goal
transcriptPins.tsanduseChatPanelTypedFields.ts, which have the same code shape but nothing visible stays stale (see Pop-out window title and history label can keep the old language after a language switch #47843).i18nT(),LanguageProvideroruseLanguageGeneration.ts.ShellTabTitlereceives as props fromuseAppShell(panelLabel): a bailed-out render of the child cannot store a new prop, so the repaint still reaches them.What changed (motivation → approach → change)
Symptom: the window title and history label keep the old language after a switch. Root cause: the owning components do not subscribe to the switch, so a bailed-out re-render can swallow the effect that hands the new label on (#47843; #47814 is the same case in the Files tree). Change:
AppPopoutFrameandShellTabTitleeach calluseLanguageGeneration()once, with a short comment on why, the same as #47852 does for the tree. The switch itself now renders each component, and that render cannot bail out because the hook's snapshot changed, so its effects run with the new strings. InappShell.tsxthe change is only the import, the hook call and its comment.Backwards compatibility
Compatible: two components subscribe to one more external store; nothing they accept or render changes.
Removes nothing: the diff only adds a hook call in two components and two tests.
Tests
website/src/test/AppPopoutFrame.test.tsx: "re-titles a core page’s window on the language switch itself, with no repaint from above". Renders the/channelscore page pop-out with noLanguageProvider, switches to Japanese, and expects the window title and the title bar to shownav.channelsin Japanese. Language is restored infinally. Adds aChannelPagemodule stub so the lazy core page does not load the real page.website/src/test/App.tabTitle.test.tsx: "names the tab and the history entry in the new language on the switch itself, with no repaint from above". RendersAppat/chatwith noLanguageProvider, waits for the shell to settle, switches to Japanese, and expects the tab title and the lastlabelCurrentRouteEntrycall to carryapp.tab_title_chatin Japanese.labelCurrentRouteEntryis wrapped in avi.fnaround the real function, so the other tests in the file see the same behaviour.Both tests fail on main and pass with the fix (output under Real-machine verification).
Proof: not provable -- frontend test (prove.py runs Python only)
Nearby inputs tested: a core page (
/channels) whose label is a catalog key; the chat route with no active session, whose tab and history label are both the chat panel label; the existing cases in both files (installed and built-in app titles, session titles, attention count, remote crew, labelled gateway, pop-out windows) still pass. Both files were run five times in shuffled order: 68/68 each time.Other checks: the 25 test files that reference either component (435 tests),
CarriedMockAnswerRatchet,chatSlice.ownership,memoBailout,renderSwitchandLanguageProvidertests, eslint on the four files,tsc -p tsconfig.app.json --noEmit,test/test_flake_pattern_ratchet.py, the comment-history, brand-name, agent-SDK-boundary and file-line-cap checks, andscripts/local-gate.py --base upstream/main --tree-scans.Review (multi-model interrogate)
Independent reviewers read the full diff against the CI review lanes' own briefs. Two reviews counted; two more were set aside because their read of the repo rules came back short.
ChannelPagestub is reached only by the new/channelscase, andlabelCurrentRouteEntryis wrapped around the real function, so every other test sees the same behaviour.toHaveBeenLastCalledWith('Chat')could be met by a call from an earlier test (the post-switch assertion, which carries the proof, is unaffected), and the tests remove the repaint rather than staging the exact re-render race.Manual verification
N/A -- unit coverage sufficient: the bug needs a re-render to land between the switch and the repaint, which the tests force by removing the repaint. No live dashboard run was done: no gateway was started and no dashboard token was minted.
Real-machine verification
Machine: own computer, Linux x86_64. vitest on the real components; no browser run, no gateway and no dashboard token.
Before (main dcc6fd1):
npx vitest run src/test/AppPopoutFrame.test.tsx src/test/App.tabTitle.test.tsx-> 2 failed:expected 'Channels — Kiro Crew' to be 'チャネル — Kiro Crew'andexpected 'Chat — Kiro Crew' to be 'チャット — Kiro Crew'After (head 26a6045): same command -> 68 passed (68), five shuffled repeats green.
Cleanup: own computer, nothing to remove.
Screenshots / video
Why no screenshot: the change is in the OS window title and the browser history menu entry, which a page screenshot does not show, and the page itself renders the same.
Related Issues
Fixes #47843
Follow-up to #47814 (fixed in open PR #47852, which edits
PierreWorkspaceTreeImpl.tsxand the header ofuseLanguageGeneration.ts; this PR touches neither, so the two land in any order). #47852's header rewrite also describes the non-memoized case this PR adds.Other open PRs that touch the same files: #45436 (
AppPopoutFrame.tsx), #47827, #41145, #41140, #31967, #31959 and #16349 (appShell.tsx). This PR'sappShell.tsxchange is three lines inShellTabTitleplus one import line.Sibling sweep
Swept:
git grep -l 'i18nT(' -- website/srcfiltered to files withoutuseLanguageGeneration()that name ani18nT-derived const in auseEffect/useLayoutEffectdependency list (the scan #47843 describes)Sibling: website/src/pages/AppPopoutFrame.tsx -- changed here
Sibling: website/src/shell/appShell.tsx -- changed here
Sibling: website/src/pierre/PierreWorkspaceTreeImpl.tsx -- tracked in #47814
Sibling: website/src/pages/chat/page/transcriptPins.ts -- not affected -- pinStatus only re-arms a timer, nothing visible stays stale
Sibling: website/src/pages/settings/useChatPanelTypedFields.ts -- not affected -- the selector is compared again whenever the deep link changes
Pattern harvest
Rule candidate: review-prompt
Pattern: an
i18nT()string passed to an effect through its dependency list in a component that does not calluseLanguageGeneration()Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commitsContribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.