Reload the page when a chunk fails to load - #88
Conversation
A deploy replaces the hashed asset files, so a tab left open across a deploy asks for chunks that no longer exist and the route fails to render. Listens for Vite's `vite:preloadError` and reloads once to pick up the new build.
✅ Deploy Preview for climate-ref ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reachedNext included review available in 32 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe frontend reloads after a Vite chunk preload error. Guarded ChangesChunk preload recovery
Merge Risk: 🟡 Moderate · up to The change recovers stale tabs after deployments by reloading on failed chunk preloads and revalidating HTML. However, users with blocked session storage can enter a reload loop if a chunk remains unavailable, so this should be fixed before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Team
Run ID: 9eb27dae-abed-4762-8e32-cce0413a3371
📒 Files selected for processing (2)
changelog/88.fix.mdfrontend/src/main.tsx
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
Guards the sessionStorage access, because a browser that blocks site data throws there and would otherwise swallow the preload error without reloading. Sends `Cache-Control: no-cache` with the SPA HTML, so the reload cannot be answered from cache with the old asset names.
|
@coderabbitai review |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Team
Run ID: c1d288ad-7604-45a7-8f15-91d5169f91f7
📒 Files selected for processing (3)
backend/src/ref_backend/builder.pychangelog/88.fix.mdfrontend/src/main.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- changelog/88.fix.md
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
|
Without storage there is no cooldown, so reloading on every preload error could loop. Lets the error surface instead.
|
@coderabbitai review |
|
Fixes the
Failed to fetch dynamically imported moduleerrors coming out of staging (REF-APP-BACKEND-1Y).The static assets are baked into the container image, so a deploy replaces every hashed file. A tab left open across a deploy then asks for a chunk that no longer exists, the dynamic import rejects, and the route blows up in the error boundary.
vite:preloadErrorinmain.tsxand reloads the page so the tab picks up the new build.This only helps tabs that were already open. It does not keep old assets around, so a truly stale bookmark to an asset URL still 404s.
Summary by CodeRabbit