Skip to content

feat: require router forms to declare an action or GET method - #8923

Open
Varixo wants to merge 1 commit into
mainfrom
fix-forms-action-required
Open

feat: require router forms to declare an action or GET method#8923
Varixo wants to merge 1 commit into
mainfrom
fix-forms-action-required

Conversation

@Varixo

@Varixo Varixo commented Aug 11, 2026

Copy link
Copy Markdown
Member

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.

@Varixo Varixo self-assigned this Aug 11, 2026
@Varixo
Varixo requested review from a team as code owners August 11, 2026 15:16
@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e0462d7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@qwik.dev/router Minor
eslint-plugin-qwik Minor
@qwik.dev/core Minor
create-qwik Minor
@qwik.dev/react Minor

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

@maiieul maiieul moved this to Waiting For Review in Qwik Development Aug 11, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8923

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@8923

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@8923

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@8923

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@8923

@qwik.dev/devtools

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/devtools@8923

commit: e0462d7

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview e0462d7


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"`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting For Review

Development

Successfully merging this pull request may close these issues.

2 participants