Repository navigation
Conversation
When a deploy replaces a route's chunk while a page is open, navigating to that route fails to import its component and ends on the error page until the user refreshes by hand. Wrap the route component import in production. On failure, resolve with an empty component so the router finishes the navigation, then reload once the URL is the destination. A failure within 10 seconds of the last reload is rethrown, so a chunk that is still missing shows the error instead of reloading in a loop. Add a reloadOnRouteChunkError option, on by default, to turn it off. Closes #1644. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 5ff9534 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
brenelz
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1644.
When a deploy replaces a route's chunk while a page is open, navigating to that route fails to import its component. The page ends on "Error | Uncaught Client Exception" until the user refreshes by hand.
Change
In production builds,
FileRouteswraps each route's component import withwithRouteChunkReload. If the import fails:sessionStorage. If the page already reloaded for this within the last 10 seconds, or storage is unavailable, it rethrows, so a chunk that is still missing shows the normal error instead of reloading in a loop.navigateEndruns in the transition's.finally), so a route that stays pending, or a reload from the placeholder'sonMount, would reload the old URL. Resolving lets the router finish the navigation.location.hrefchanges from the URL at the time of the failure. If it never changes within 1 second, for example a same-URL navigation, it reloads anyway. Watching the URL instead of relying on the router's internal order also works with params and with other routers.Only route chunks are covered. The user is already leaving the page there, so the reload loses nothing extra. Nuxt does the same by default (
emitRouteChunkError: "automatic"). Other dynamic imports, such asclientOnlyorlazy()components in the middle of a page, are left alone, since a reload could throw away state. For those, Vite'svite:preloadErrorevent is the place to hook in.A new
reloadOnRouteChunkErroroption, on by default, turns this off. It is passed to the client throughdefine, the same way asdevOverlay. Dev builds are not affected, since a failed import there is a real error.Testing
A real deploy on the
basicfixture, production build. Build v1 and open/. Then stop the server, changeabout.tsx, build v2, restart on the same port, and click About in the open v1 tab:/about/about/aboutreloadOnRouteChunkError: false/about/aboutAn earlier version of this change kept the route pending instead of resolving it. It reloaded back to
/, because the router had not moved to the destination yet, which is why it now resolves with an empty component and watches the URL.route-chunk-reload.spec.ts(6 tests): passes the module through on success. On failure, resolves with an empty component and reloads only after the URL changes. Reloads after the timeout if the URL does not change. Rethrows a second failure within the window. Reloads again after the window. Rethrows without reloading whensessionStoragethrows.@solidjs/starttest:ci(246 tests),typecheck,validate-importsandbuildpass.apps/testsunit tests (6), Playwright (42), bundled-dev Playwright (42) ande2e:base(3) pass. Those e2e configs run dev servers, so they cover that dev is unaffected but not the reload itself. The repo has no production e2e config, which is why the deploy test above was run by hand.A matching PR for the
1.xbranch follows.🤖 Generated with Claude Code