Skip to content

[codex] fix dashboard stale lazy chunk reload#379

Draft
anarkh wants to merge 1 commit into
masterfrom
codex/fix-dashboard-stale-chunk-reload
Draft

[codex] fix dashboard stale lazy chunk reload#379
anarkh wants to merge 1 commit into
masterfrom
codex/fix-dashboard-stale-chunk-reload

Conversation

@anarkh

@anarkh anarkh commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix dashboard route failures after the CLI/dashboard assets are rebuilt while an existing App or browser window still holds the previous SPA entry script.

Root Cause

Dashboard route pages are lazy-loaded as content-hashed chunks. If an already-loaded app.js points to an old chunk name that has been removed by a rebuild or upgrade, routes such as groups, roles, and bot defaults fail with Failed to fetch dynamically imported module.

Changes

  • Add a focused stale lazy-chunk detector for dashboard route imports.
  • Reload the dashboard shell once per missing chunk using a sessionStorage guard.
  • Preserve the original route error path for ordinary render failures or when browser storage cannot be read.
  • Add unit coverage for one-time reload behavior, ordinary errors, storage failures, and browser storage getter failures.

Validation

  • pnpm exec vitest run --project unit test/dashboard-stale-chunk-reload.test.ts test/dashboard-route-lifecycle.test.ts test/dashboard-route-smoke.test.ts
  • pnpm exec tsc --noEmit
  • git diff --check

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