-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support formmethod and formaction in ViewTransitions #9084
Conversation
🦋 Changeset detectedLatest commit: 8a9eb44 The changes in this PR will be included in the next version bump. 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 |
@@ -88,11 +88,14 @@ const { fallback = 'animate', handleForms } = Astro.props; | |||
} | |||
|
|||
const form = el as HTMLFormElement; | |||
const submitter: HTMLButtonElement | null = ev.submitter as any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is any
the correct type? Should it be unknown
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was being too clever with types, didn't need it, so removed it.
const formData = new FormData(form); | ||
// Use the form action, if defined, otherwise fallback to current path. | ||
let action = form.action ?? location.pathname; | ||
let action = submitter?.getAttribute('formaction') ?? form.action ?? location.pathname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let action = submitter?.getAttribute('formaction') ?? form.action ?? location.pathname; | |
const action = submitter?.getAttribute('formaction') ?? form.action ?? location.pathname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
action
is mutated in an if
after this.
Co-authored-by: Emanuele Stoppa <[email protected]>
* Support formmethod and formaction in ViewTransitions * Adding a changeset * Update .changeset/new-pets-fail.md Co-authored-by: Emanuele Stoppa <[email protected]> * Be less clever --------- Co-authored-by: Emanuele Stoppa <[email protected]>
Changes
<button type="submit" formmethod="post" formaction="/other">
.Testing
Docs
N/A, bug fix