feat: require router forms to declare an action or GET method - #8923
feat: require router forms to declare an action or GET method#8923Varixo wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: e0462d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
@qwik.dev/core
@qwik.dev/router
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
@qwik.dev/devtools
commit: |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
|
|
||
| Actions can also be triggered programmatically using the `action.submit()` method (i.e. you don't need a `<Form/>` component). However, you can trigger the action from a button click or any other event, just like you would do with a function. | ||
|
|
||
| When handling a submit event yourself, use a native `<form>` instead of the router's `<Form>`, which requires either an `action` or `method="get"`. |
There was a problem hiding this comment.
Don't programmatic actions work without action/method="get"?
Paragraph above says "(i.e. you don't need a <Form/> component)", but here it says to use <form> to handle submit events. It's a bit unclear to me and will be to many readers.
There was a problem hiding this comment.
I dont understand the question, Form and form are not the same. When handling manual submit you have to use form, when not you should use Form component. This PR disallow using GET method together with manual handling, because it will cause often a race condition for submit and manual redirect and redirect by Form component itself after submit
Require Qwik Router Form to declare either an action or an explicit GET method, preventing unintended navigation when submission is handled manually. Add development-only diagnostics recommending a native
for custom submit handling, while preserving production behavior.