Skip to content

perf(raycast): avoid useForm error state no-op churn#562

Closed
JustYannicc wants to merge 71 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-raycast-use-form-error-noop
Closed

perf(raycast): avoid useForm error state no-op churn#562
JustYannicc wants to merge 71 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-raycast-use-form-error-noop

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Updated useForm error state handling to use the existing guarded clearFormFieldError and setFormFieldError helpers.
  • Added scripts/test-use-form-error-state-noop.mjs with source checks and identity-churn measurements for no-op clears and same-value error sets.

Why

useForm.setValue cloned the error map and deleted the changed field on every value change, even when that field had no error. That republished a new error object for no-op clears and could drive avoidable render/state churn.

Compatibility impact

Raycast extension behavior is preserved. Changing a field with an existing error still clears only that field and preserves unrelated errors. Setting a different validation error still publishes the new error. Same-value validation error sets now return the previous error map.

How tested

  • node --test scripts/test-use-form-error-state-noop.mjs passed.
  • node --test scripts/test-form-runtime-error-state-noop.mjs passed.
  • node --test scripts/test-use-form-error-state-noop.mjs scripts/test-form-runtime-error-state-noop.mjs passed, 6/6 tests.
  • ./node_modules/.bin/tsc -p tsconfig.renderer.json --noEmit passed.
  • node /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js run build:renderer passed.
  • Codex LSP TypeScript status/symbols/diagnostics were retried after installing local tooling; use-form.ts diagnostics reported no errors.

Performance evidence

node scripts/test-use-form-error-state-noop.mjs --report showed no-error field changes now keep the same error object: 10 changes before 10 identity changes, after 0; 100 changes before 100, after 0; 1000 changes before 1000, after 0. The same report verifies same-error sets keep identity, changed errors publish, and clearing an existing error removes only that field while preserving unrelated errors.

Stack validation

Started from fork/codex/perf-consolidated-integration-stack resolving to 264fb89dc5c867d6c3d77bc4b95e26e235e326ea, matching the initial detached HEAD, before creating codex/perf-raycast-use-form-error-noop.

Replaces

Implements the delegated Raycast useForm error-state no-op churn finding from source thread 019f2bf5-ccf0-7791-b5ec-844ed436e725; no prior PR is replaced.

…ated-integration-stack

# Conflicts:
#	src/renderer/src/raycast-api/hooks/use-cached-promise.ts
…ated-integration-stack

# Conflicts:
#	src/renderer/src/raycast-api/list-runtime-renderers.tsx
#	src/renderer/src/raycast-api/list-runtime.tsx
…ated-integration-stack

# Conflicts:
#	src/renderer/src/CameraExtension.tsx
…ated-integration-stack

# Conflicts:
#	src/renderer/src/raycast-api/list-runtime.tsx
… into codex/perf-consolidated-integration-stack
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by the consolidated wave-2 UI/runtime PR: #572

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