AddThisFeature

Form State Isolation

Keep long forms responsive by narrowing what re-renders when one field changes.

involved Developer Experience

What it adds

Section-scoped form state with field-level subscriptions, so typing in one input does not re-render the entire form.

What your agent is told to do

5
  1. 1

    Find the forms that visibly lag — the settings pages, the multi-section record editors, the pricing or configuration builders — and measure which of them re-render every field on every keystroke before changing anything.

  2. 2

    Give each field its own subscription to its own value and its own error, so a component re-renders when the thing it displays changes and not before.

  3. 3

    Keep cross-field rules — totals, date ranges, one-of-these-is-required, conditional sections — subscribed to the specific fields they depend on, and evaluate them against the whole form's current values rather than a stale snapshot taken when the section mounted.

  4. 4

    Preserve section values and dirty state when a section unmounts because it collapsed, scrolled out of a virtualized list, or moved behind a step. The form owns the values; the section only displays them.

  5. 5

    The warning shown when a user tries to leave with unsaved work belongs to Unsaved Changes Guard. This feature owns which values count as dirty and how they survive unmounting; that feature owns intercepting navigation. Do not implement a second navigation prompt here.

Edge cases it handles

7
  • Cross-field validation must stay accurate under isolation. A rule that only re-runs when its own field changes will keep showing an end-date error after the start date was corrected, so rules must be re-evaluated when any of their inputs move.
  • A collapsed, hidden, or scrolled-away section must keep its values and its dirty flag. Losing them on unmount silently discards work the user believes is entered, and it is worse than a visible error because nothing tells them.
  • Fields hidden by a conditional must not contribute stale values to validation or to the payload. Decide explicitly whether hiding clears the value or merely excludes it, and apply the same rule everywhere.
  • Partial saves need to know exactly which fields the user changed, so a section-level save sends only that section and does not overwrite a colleague's concurrent edit to a field the user never touched.
  • Server-side validation errors arrive keyed to fields that may be inside a collapsed section, so the form must open the section, scroll to the field, and move focus rather than showing a generic failure at the top.
  • Arrays of repeated rows must keep identity across reorders and deletions; keying rows by index makes the wrong row inherit another row's error and dirty state.
  • An autosave or a background refresh landing mid-edit must not replace a field the user is currently typing in.

Definition of done

9
  • Typing in one field re-renders that field and its dependent rules, not the whole form.
  • Cross-field validation produces the same result under isolation as it did when the form re-rendered wholesale.
  • Collapsing, hiding, or scrolling a section away preserves its values and its dirty state.
  • Conditionally hidden fields follow one documented rule for whether their values are cleared or merely excluded.
  • A partial save submits only the fields the user actually changed.
  • A server validation error reveals, scrolls to, and focuses the offending field wherever it sits.
  • Dirty tracking is exposed for the unsaved-changes guard rather than duplicated by it.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.