Skip to content

fix(qwik-router): let Form onSubmitCompleted$ accept an inline handler - #9204

Merged
Varixo merged 1 commit into
QwikDev:mainfrom
tzdesign:fix/form-plain-handler-types
Oct 13, 2026
Merged

Varixo merged 1 commit into
QwikDev:mainfrom
tzdesign:fix/form-plain-handler-types

Conversation

@tzdesign

Copy link
Copy Markdown
Contributor

What is it?

  • Bug

Description

In v2, FormProps.onSubmitCompleted$ is typed as QRLEventHandlerMulti only. Form is a plain function component, so its props don't go through PublicProps/_AllowPlainQrl, and an inline handler fails type checking:

<Form action={action} onSubmitCompleted$={() => { ... }} />
// Type '() => void' is not assignable to type 'QRLEventHandlerMulti<...>'

At runtime this works, because the optimizer turns the inline handler into a QRL. In Qwik City 1 the prop was a plain function type, so migrated apps hit this everywhere (18 places in our shop, all wrapped in $() as a workaround).

The prop now also accepts EventHandler<...>, the same way the native on*$ events do (QwikKnownEventsPlain). The API report and docs are regenerated.

Checklist

  • My code follows the developer guidelines of this project
  • I performed a self-review of my own code
  • I added a changeset with pnpm change
  • I added new tests to cover the fix / functionality

form-component.unit.tsx adds type-only tests: an inline handler gets a typed event and form, QRLs and arrays of QRLs still work, and a handler for a different event is rejected. The inline handler test fails type checking without the fix; all 804 qwik-router unit tests pass.

Form is a plain function component, so its props don't go through PublicProps and an inline onSubmitCompleted$ handler failed type checking, although the optimizer turns it into a QRL at runtime. Accept EventHandler like the native on*$ events do.
@tzdesign
tzdesign requested review from a team as code owners October 13, 2026 08:10
@changeset-bot

changeset-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4e2adf8

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

This PR includes changesets to release 8 packages
Name Type
@qwik.dev/router Patch
eslint-plugin-qwik Patch
@qwik.dev/mcp Patch
create-qwik Patch
@qwik.dev/devtools Patch
@qwik.dev/react Patch
@qwik.dev/utils Patch
@qwik.dev/core Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

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

@qwik.dev/router

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

@qwik.dev/utils

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/utils@9204

eslint-plugin-qwik

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

create-qwik

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

@qwik.dev/optimizer

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

@qwik.dev/devtools

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

@qwik.dev/mcp

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/mcp@9204

commit: 4e2adf8

@Varixo Varixo left a comment

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.

LGTM, thanks for the PR!

@Varixo
Varixo merged commit 664ec61 into QwikDev:main Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants