Repository navigation
fix(qwik-router): let Form onSubmitCompleted$ accept an inline handler - #9204
Merged
Merged
Conversation
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.
🦋 Changeset detectedLatest commit: 4e2adf8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 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
@qwik.dev/utils
eslint-plugin-qwik
create-qwik
@qwik.dev/optimizer
@qwik.dev/devtools
@qwik.dev/mcp
commit: |
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.
What is it?
Description
In v2,
FormProps.onSubmitCompleted$is typed asQRLEventHandlerMultionly.Formis a plain function component, so its props don't go throughPublicProps/_AllowPlainQrl, and an inline handler fails type checking: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 nativeon*$events do (QwikKnownEventsPlain). The API report and docs are regenerated.Checklist
pnpm changeform-component.unit.tsxadds type-only tests: an inline handler gets a typedeventandform, 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.