Repository navigation
feat(1.x): reload once when a route chunk fails to load - #2349
Merged
Merged
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. In production, wrap the route component import in lazyRoute. 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>
🦋 Changeset detectedLatest commit: 83e14e0 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 on the 1.x line. Same change as #2348 on
main.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
lazyRoute's production branch wrapscomponent.import()withwithRouteChunkReload, in the browser only. The wrapper is the same as onmain. On a failed import it checks a 10-second loop guard insessionStorage, resolves with an empty component so the router finishes the navigation, and reloads oncelocation.hrefis the destination. It falls back to reloading after 1 second. A second failure within the window is rethrown. feat(router): reload once when a route chunk fails to load #2348 explains why it resolves instead of staying pending.reloadOnRouteChunkErroroption indefineConfig, on by default, passed to the client throughdefinein all three routers, the same way asdevOverlay. It is typed inconfig/index.d.tsandenv.d.ts.lazyRouterather than through Vite'svite:preloadErrorevent. 1.x loads route components with a computedimport(MANIFEST.client.inputs[...].output.path), which does not go through Vite's preload helper, so that event never fires for route chunks here. I checked this in a production build.Testing
A real deploy on the 1.x
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:origin/1.x/about/about/aboutreloadOnRouteChunkError: false/about/aboutroute-chunk-reload.spec.ts(6 tests), the same as onmain.@solidjs/starttest:ci(101 tests) andtypecheckpass.apps/testsbuild,unit:ciand the full Cypress suite against the production build (19) pass.🤖 Generated with Claude Code