meta(ai): Add form submit + mutation guidance to migration skill#115358
Open
priscilawebdev wants to merge 3 commits into
Open
meta(ai): Add form submit + mutation guidance to migration skill#115358priscilawebdev wants to merge 3 commits into
priscilawebdev wants to merge 3 commits into
Conversation
Two patterns kept getting flagged in form-migration PR reviews but were not explicit in the migrate-frontend-forms skill: - No generics on `useMutation`. Type the `mutationFn` payload and use `fetchMutation<T>` for the return type. - Forms with a Save button must run the mutation inside `onSubmit` and use `<form.SubmitButton>`. A `<form.AppForm>` that is never submitted bypasses validation, pending/disabled state, and field-error wiring. Add a prominent "Patterns to Always Follow" section after the feature mapping table and matching items to the migration checklist. Refs #115256 (comment) Refs #115256 (comment) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Restructure the previous commit so the two notes follow the skill's existing pattern (guidance embedded under the relevant feature subsection) instead of a new top-level section: - Move the `useMutation` generics note next to the existing "typing mutations correctly" callout under `getData → mutationFn`. - Move the "submit through the form" note under `saveOnBlur: false → useScrapsForm`, which is where the Save button pattern lives. The migration checklist entries stay — the checklist already aggregates points from across sections. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The ✅ side of the submit block restated what the SlugForm example above already shows. Keep only the ❌ antipattern and point readers back to SlugForm for the correct shape. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Document two patterns in the
migrate-frontend-formsskill that keep getting flagged in review:useMutation— type themutationFnpayload;fetchMutation<T>carries the return type. Added next to the existing "typing mutations correctly" callout undergetData → mutationFn.onSubmit, Save button is<form.SubmitButton>. Don't render<form.AppForm>without anonSubmitand fire the mutation from a standalone<Button onClick>. Added undersaveOnBlur: false → useScrapsForm.Plus two matching items on the migration checklist.