fix(ClientRouter): pass location.href as base to new URL() in GET for…#16910
Closed
jettwayio wants to merge 3 commits into
Closed
fix(ClientRouter): pass location.href as base to new URL() in GET for…#16910jettwayio wants to merge 3 commits into
jettwayio wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 214f933 The changes in this PR will be included in the next version bump. This PR includes changesets to release 397 packages
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 |
ematipico
requested changes
Jun 2, 2026
Member
ematipico
left a comment
There was a problem hiding this comment.
I'm not sure what we're fixing (there's no report). However, we can't accept this PR without a test
Author
|
I wasn't able to produce a reproducible failure case on current Astro, so I'm closing this for now. |
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.
Changes
Pass
location.hrefas the base tonew URL(action)in the GET form handler.The origin check directly above already uses
new URL(action, location.href)correctly, but the GET branch constructs the URL without a base.submitter.getAttribute('formaction')returns the raw attribute value which may be a relative path,new URL('/contact')throws a TypeError in the browser. This aligns the GET branch with the existing origin check.Testing
Reproduce with a GET form using a relative
formactionon a submit button with<ClientRouter />enabled:Before this fix, clicking the button throws a TypeError. After, it resolves correctly.
Docs
This change does not affect docs. No behaviour change for absolute URLs, and relative
formactionsupport was already implied by the surrounding code.