Skip to content

meta(ai): Add form submit + mutation guidance to migration skill#115358

Merged
priscilawebdev merged 3 commits into
masterfrom
priscila/meta/form-migration-skill-patterns
May 13, 2026
Merged

meta(ai): Add form submit + mutation guidance to migration skill#115358
priscilawebdev merged 3 commits into
masterfrom
priscila/meta/form-migration-skill-patterns

Conversation

@priscilawebdev
Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev commented May 12, 2026

Document two patterns in the migrate-frontend-forms skill that keep getting flagged in review:

  • No generics on useMutation — type the mutationFn payload; fetchMutation<T> carries the return type. Added next to the existing "typing mutations correctly" callout under getData → mutationFn.
  • Submit through the form — mutation runs in onSubmit, Save button is <form.SubmitButton>. Don't render <form.AppForm> without an onSubmit and fire the mutation from a standalone <Button onClick>. Added under saveOnBlur: false → useScrapsForm.

Plus two matching items on the migration checklist.

priscilawebdev and others added 3 commits May 12, 2026 08:40
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
@priscilawebdev priscilawebdev marked this pull request as ready for review May 12, 2026 07:34
@priscilawebdev priscilawebdev requested a review from a team as a code owner May 12, 2026 07:34
@priscilawebdev priscilawebdev merged commit d7e8bc4 into master May 13, 2026
55 checks passed
@priscilawebdev priscilawebdev deleted the priscila/meta/form-migration-skill-patterns branch May 13, 2026 06:46
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