Skip to content

refactor(groupwizard): drop unreachable empty-fields branch in handleNext - #51

Merged
chriskehayias merged 1 commit into
devfrom
refactor/groupwizard-drop-dead-empty-fields-branch
Oct 10, 2026
Merged

chriskehayias merged 1 commit into
devfrom
refactor/groupwizard-drop-dead-empty-fields-branch

Conversation

@chriskehayias

Copy link
Copy Markdown
Contributor

Summary

  • Removed the !fields || fields.length === 0 special case from GroupWizard.handleNext. Only the Review step's STEP_FIELDS entry is empty, and Review renders Submit (handleSubmit), never Next, so the branch could not run.
  • handleNext now always calls form.trigger(STEP_FIELDS[currentStep]). In react-hook-form 7.89 with a resolver, trigger([]) resolves true and updates no field errors. A missing entry (undefined) validates the whole form, so a future misconfiguration fails safe instead of skipping validation.
  • New schema.test.ts case: STEP_FIELDS has an entry per WIZARD_STEPS, every step before Review lists fields, and only Review is empty.
  • group-wizard.tsx goes from 94.5% to 100% statements. Deleted the closed TODO and updated INDEX.md.

Test plan

  • npm run lint
  • npm run typecheck
  • npm run test:coverage (2097 passed)

🤖 Generated with Claude Code

…Next

The `!fields || fields.length === 0` special case could never run: only
the Review step has an empty STEP_FIELDS entry, and Review shows Submit,
not Next. form.trigger([]) resolves true with the zod resolver anyway,
and a missing entry (undefined) validates the whole form, so calling
trigger unconditionally fails safe. Adds a schema test pinning that every
step before Review lists fields. group-wizard.tsx is now 100% statements.

Closes the 2026-09-13 dead-empty-fields-branch-handlenext TODO.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chriskehayias
chriskehayias merged commit 3243b93 into dev Oct 10, 2026
2 checks passed
@chriskehayias
chriskehayias deleted the refactor/groupwizard-drop-dead-empty-fields-branch branch October 10, 2026 15:53
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