fix: discard a consumed preloaded redirect before following it - #16955
Merged
Conversation
Co-authored-by: Benjamin Davis <davis.benjamin41902@gmail.com>
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/6a9437da6b85f0182d724b6b34170b41297db8fdOpen in |
🦋 Changeset detectedLatest commit: 6a9437d 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 |
Rich-Harris
approved these changes
Aug 27, 2026
Rich-Harris
left a comment
Member
There was a problem hiding this comment.
sad that we can't induct @bmdavis419 as a contributor — next time! — but happy for the fix
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.
In
runtime/client/client.js,_preload_datastores everyload_routeresult inload_cacheandload_routehands the entry back whenever the intent id matches.navigateonly clearsload_cacheon the commit path, afterhistory.pushState; the redirect branch recurses intonavigatefor the redirect target and returns before that. So when a preloaded route redirects and a later hop of the same navigation comes back to it (a gate:/dashboardredirects to/selectuntil a flag is set,/selectsets it and redirects to/dashboard), the cached redirect is replayed without a fetch on every return until the 20-redirect limit renders the 500 page.Discard the consumed entry in the redirect branch before recursing, keyed on
intent.idso a preload of a different route (such as the redirect target) survives. The first hop is still served from the preload; anything after it loads fresh.Fixes #16484.
Replaces #16930. Thank you for the attempt @bmdavis419, big fan of your content.