fix(presentation): reset chunk recovery per route and offer a reload (R-8.1)

React Router 7 reuses the rendered-route instance between sibling routes,
so ChunkRecoveryBoundary kept its error/support state after the user left
the failed route and every later page showed "화면 자산을 복구하지 못했습니다"
until a manual browser reload. The boundary is now keyed by routeId, and
the support surface has a user-started "한 번 새로고침" button.

Verified: RED "clears a failed route chunk when the user moves to a sibling
route" (failure surface still rendered after navigating to /examples/ui)
and "offers a user-started reload on the failure surface" (no button) both
failed before the fix and pass after. check:architecture, check:types:app,
check:types:test, lint, test:component pass; test:unit passes except the
pre-existing removal-fixture test, which needs generated artifacts/ files
absent from a fresh worktree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-24 12:39:51 +09:00
co-authored by Claude Opus 5.5
parent 2fb07c857a
commit ad2b733ae9
3 changed files with 72 additions and 0 deletions
@@ -3,6 +3,7 @@ import {
type ErrorInfo,
type ReactNode,
} from "react";
import { Button } from "../design-system/index.ts";
import { useLocale } from "../i18n/index.ts";
type RecoveryResult =
@@ -110,6 +111,10 @@ function ChunkRecoverySurface({
<section className="ui-page" role="alert" data-recovery-reason={reason}>
<h1>{message("chunk.failure.title")}</h1>
<p>{message("chunk.failure.description")}</p>
{/* The automatic reload-once already declined; this one is the user's. */}
<Button onClick={() => window.location.reload()}>
{message("action.reloadOnce")}
</Button>
</section>
);
}
+3
View File
@@ -318,7 +318,10 @@ function RegisteredRoute({
<CanonicalRouteRedirect input={parsed.data} />
<RouteLifecycle definition={definition} buildId={buildId} />
<Suspense fallback={<RouteLoadingSurface definition={definition} />}>
{/* React Router reuses this instance across sibling routes; the key
keeps one route's failed chunk from latching onto the next. */}
<ChunkRecoveryBoundary
key={definition.routeId}
chunkId={definition.chunkId}
recover={recovery.recoverChunk}
>