Skip to content

feat(forms): add field arrays, wizard flow, and disabled/readOnly controls#83

Merged
RtlZeroMemory merged 2 commits into
mainfrom
form-features
Feb 18, 2026
Merged

feat(forms): add field arrays, wizard flow, and disabled/readOnly controls#83
RtlZeroMemory merged 2 commits into
mainfrom
form-features

Conversation

@RtlZeroMemory

Copy link
Copy Markdown
Owner

Summary

  • add useFieldArray with append, remove, and move
  • add multi-step wizard support with step-gated navigation
  • add form-level disabled/readOnly with per-field overrides
  • update forms docs and exports/types

Tests

  • added 44 deterministic form tests across:
    • form.fieldArray.test.ts
    • form.wizard.test.ts
    • form.disabled.test.ts
  • npm run lint
  • npm run build
  • npm run typecheck
  • node scripts/run-tests.mjs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5f12e9b43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +88 to +90
for (let i = 0; i < currentValue.length; i++) {
dirty.push(!Object.is(currentValue[i], initialValue[i]));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Track array length changes when computing dirty state

computeArrayFieldDirty only compares indices up to currentValue.length, so shrinking an array with an unchanged prefix (for example ['a','b'] to ['a']) yields all-false dirty flags. Since computeIsDirty only looks for any true, the form can report isDirty === false even though values changed, which breaks unsaved-change detection for array fields.

Useful? React with 👍 / 👎.

Comment thread packages/core/src/forms/useForm.ts Outdated
Comment on lines +907 to +909
const step = getStep(currentStep);
const stepFields = getStepFields(step, state.values);
const stepErrors = runWizardStepValidation(state.values, currentStep, state);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate against latest step before advancing wizard

nextStep validates using the render-time currentStep/state.values snapshot, but the state update increments from prev.currentStep. If nextStep (or wizard-mode handleSubmit) is called twice before rerender, both validations run for the old step while both increments apply, so the wizard can skip intermediate-step validation gates.

Useful? React with 👍 / 👎.

@RtlZeroMemory

Copy link
Copy Markdown
Owner Author

Addressed the two review findings in 3e37107:

  • fixed array dirty tracking when array length changes (including shrink cases)
  • fixed wizard step-gate race so repeated nextStep / wizard-mode handleSubmit calls before rerender cannot skip intermediate validation
  • added regression tests for both behaviors

Validation rerun:

  • npm run lint
  • npm run build
  • npm run typecheck
  • node scripts/run-tests.mjs

All passing.

@RtlZeroMemory
RtlZeroMemory merged commit 38efadb into main Feb 18, 2026
16 of 18 checks passed
@RtlZeroMemory
RtlZeroMemory deleted the form-features branch February 19, 2026 17:45
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