Repository navigation
fix(navigation): reuse the redirected response instead of refetching - #578
Open
MaxtuneLee wants to merge 1 commit into
Open
MaxtuneLee wants to merge 1 commit into
MaxtuneLee wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
summary
Close #560
When a visit receives a redirect for example
303 see other, the browser automatically follows the redirect by issuing a GET request to the URL specified in theLocationheader, and return the final GET response.loadNavigationShell()detectedresponse.redirectedand then called itself again withGET, so the destination was requested a second time and the first response was thrown away.This could also produce inconsistent results when the destination depends on server-side state.
This PR refactors the redirect handling so that it updates the local state (method, fetchUrl, url, and commitTarget) to point to the final destination, continuing through the standard parsing and rendering pipeline using the existing response.
Files touched
packages/void/src/pages/navigation-engine.ts: replace the recursiveloadNavigationShell()call in theresponse.redirectedbranch with state update that reuses the existing response.packages/void/test/unit/pages-client.test.ts: update "follows a same-host Capacitor action redirect in place" so the redirected response carries real page data and the test assertsfetchis called once. (It previously asserted the second GET)Test plan
vp test run packages/void/test/unit/pages-client.test.ts(67 passed)