fix(reports): switching editions replaces the reader instead of stacking it (BUG-1126)
Independent Staging Quality Gate / validate (push) Successful in 14m44s
Independent Staging Quality Gate / publish (push) Successful in 3m32s

The reader and the fact tables were siblings keyed by the same language, so
React left the first edition's reader on screen and appended the new one.
Distinct keys per sibling; whole-page switch test with real engine fact tables.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
Jesse_Chen
2026-09-30 17:13:28 +08:00
co-authored by Claude Opus 5.5
parent 5604c11bb4
commit d87ec44aab
7 changed files with 160 additions and 9 deletions
@@ -564,9 +564,10 @@ export function PersonalReportPage({ reportId, initialLanguage = "zh" }: { repor
onLanguageChange={switchLanguage}
/>
<div className="personal-report-reader-body" lang={shown === "en" ? "en" : "zh-CN"}>
<PersonalReportMarkdownView key={shown} language={shown} markdown={markdown} drawnThrough={drawnThrough} />
{/* Siblings remount per edition under distinct keys; a shared key left the old edition on screen (BUG-1126). */}
<PersonalReportMarkdownView key={`markdown-${shown}`} language={shown} markdown={markdown} drawnThrough={drawnThrough} />
{state.calculationCharts && <ReportCalculationCharts charts={state.calculationCharts} language={shown} />}
{factTables && <ReportFactTables key={shown} language={shown} tables={factTables} />}
{factTables && <ReportFactTables key={`facts-${shown}`} language={shown} tables={factTables} />}
</div>
</div>
</>