Skip to content

refactor: implement tanstack form for all forms#8

Draft
raae wants to merge 7 commits intomainfrom
feat-tanstack-form-gradual-4PhW9
Draft

refactor: implement tanstack form for all forms#8
raae wants to merge 7 commits intomainfrom
feat-tanstack-form-gradual-4PhW9

Conversation

@raae
Copy link
Contributor

@raae raae commented Oct 30, 2025

No description provided.

@raae raae force-pushed the feat-tanstack-form-gradual-4PhW9 branch from bba26bc to 3a7f67d Compare October 30, 2025 14:40
@raae raae force-pushed the feat-tanstack-form-gradual-4PhW9 branch from 3a7f67d to 04c7c2a Compare October 30, 2025 14:45
@raae raae requested a review from Copilot November 6, 2025 09:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors multiple route components to use @tanstack/react-form instead of local useState for form state management. The changes introduce form validation with zod, auto-apply functionality for existing embeds, and better button states based on mutation status.

  • Migrates state management from useState to @tanstack/react-form across all route components
  • Adds form validation using zod schemas with custom refinement rules
  • Implements auto-apply pattern that triggers mutations when form values change on existing embeds

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/routes/user.index.tsx Replaced tab state management with form, added auto-apply on tab change
src/routes/support.index.tsx Added minimal form integration for consistent submission handling
src/routes/lead-capture.index.tsx Migrated uid state to form with validation, added auto-apply pattern
src/routes/email-list.index.tsx Migrated uid state to form with validation, added auto-apply pattern
src/routes/auth.login.tsx Added form integration for submission handling
src/routes/auth.index.tsx Complex migration of multiple fields (preselect, familyUid, planUid, discountCode) to form with validation refinements
Comments suppressed due to low confidence (2)

src/routes/email-list.index.tsx:59

  • Unused variable cfg.
      const cfg: EmailListEmbedConfig = { uid: value.uid };

src/routes/lead-capture.index.tsx:58

  • Unused variable cfg.
      const cfg: LeadCaptureEmbedConfig = { uid: value.uid };

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const cfg: LeadCaptureEmbedConfig = { uid: value.uid };
switch (embedMode) {
case "embed":
await embedMutation.mutateAsync();
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The cfg variable is defined but never used. The embedMutation uses the config variable defined at line 76 instead. Either remove the unused cfg variable or pass it to the mutation if it was intended to use the form's submitted value.

Suggested change
await embedMutation.mutateAsync();
await embedMutation.mutateAsync(cfg);

Copilot uses AI. Check for mistakes.
const cfg: EmailListEmbedConfig = { uid: value.uid };
switch (embedMode) {
case "embed":
await embedMutation.mutateAsync();
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The cfg variable is defined but never used. The embedMutation uses the config variable defined at line 78 instead. Either remove the unused cfg variable or pass it to the mutation if it was intended to use the form's submitted value.

Suggested change
await embedMutation.mutateAsync();
await embedMutation.mutateAsync(cfg);

Copilot uses AI. Check for mistakes.
@raae raae marked this pull request as draft November 13, 2025 11:08
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.

1 participant

Comments