Skip to content

perf(form): skip no-op error state updates#542

Closed
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-form-noop-state-pr
Closed

perf(form): skip no-op error state updates#542
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-form-noop-state-pr

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Guard Form runtime error clearing so setValue returns the previous errors object when the changed field has no stored error.
  • Add a same-value guard for setError to avoid republishing identical error maps.
  • Add a focused source/state harness covering no-error field changes, existing error clearing, and same/different error setting.

Why

Ordinary field changes were cloning and publishing the Form error snapshot even when no error existed for that field. Because the Form context carries the error snapshot, this created needless state identity churn on typing.

Compatibility impact

No intended behavior change: value updates, placeholder fallback, real error clearing, and submit values remain unchanged.

How tested

  • Before metric: 10/100/1000 no-error field changes -> 10/100/1000 error identity changes.
  • After metric (node scripts/test-form-runtime-error-state-noop.mjs --report): 10/100/1000 -> 0/0/0.
  • node --test scripts/test-form-runtime-error-state-noop.mjs
  • node --test scripts/test-*.mjs (clean PR branch: 27 pass, 1 skipped, 0 fail)
  • LSP: form-runtime-state.ts clean; form-runtime.tsx LSP reported missing React resolution noise despite installed module links. Direct compiler check on the clean PR branch is blocked by existing unrelated renderer errors outside the touched form files.

Stack validation

This clean PR branch was created from origin/main and contains one cherry-picked worker commit. It is part of the consolidated performance stack and should be reviewed with/after #530-#535 and JustYannicc:codex/perf-consolidated-integration-stack.

@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated upstream PR #555.

@JustYannicc JustYannicc closed this Jul 3, 2026
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