fix: recover from stale Vite chunk load failures#349
Conversation
…tion and circuit breaker (cherry picked from commit 4ae106c)
…r chunk-error recovery (cherry picked from commit aa6e1f0)
(cherry picked from commit 890dcfb)
… circuit breaker (cherry picked from commit 55c9db5)
…initChunkErrorRecovery idempotent, add unit test coverage (cherry picked from commit fdbefe5)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d3786f3804
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch { | ||
| return true |
There was a problem hiding this comment.
Prevent reload loops when sessionStorage is blocked
When sessionStorage access throws (for example, users with storage/cookies disabled), shouldReload() currently returns true unconditionally, so every chunk-load failure triggers another window.location.reload() with no working cooldown. In that environment, a stale-chunk condition can trap the app in repeated reloads and make it unusable; the fallback path should use a non-persistent in-memory breaker or return false after the first attempted reload instead of always allowing reload.
Useful? React with 👍 / 👎.
Supersedes #337. PR #337 is stale/dev-based and carries unrelated old dev/fresh-agent history; this replacement branch is rebuilt from current origin/main and only ports the focused chunk-recovery work.
Ported commits/content:
Scope:
Verification:
FRESHELL_TEST_SUMMARY="chunk recovery focused tests" npm run test:vitest -- --run test/unit/client/lib/import-retry.test.ts test/unit/client/lib/chunk-error-recovery.test.ts test/unit/client/components/ui/error-boundary.test.tsx(32 tests).PORT=3345 npm run buildpassed client typecheck and Vite client build, then failed server compilation in unchanged/home/user/code/freshell/.worktrees/chunk-error-recovery-main-20260518/server/mcp/freshell-tool.tsat lines 73 and 472. The same syntax exists on currentorigin/main; this branch does not touch that file.