Skip to content

fix: clear form snapshots on unmount#597

Closed
JustYannicc wants to merge 115 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-wave4-form-snapshot-cleanup
Closed

fix: clear form snapshots on unmount#597
JustYannicc wants to merge 115 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-wave4-form-snapshot-cleanup

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Added owner-aware cleanup for Raycast Form runtime global snapshots on Form unmount.
  • Preserved mounted Form snapshot publishing for values, errors, and placeholders used by Action.SubmitForm.
  • Added a focused runtime harness that mounts, updates, and unmounts the Form runtime while measuring retained snapshot keys and serialized bytes.

Why

Unmounted Form views could leave submitted values, error maps, placeholders, and their object graphs retained in module-global snapshots after the view was gone.

Compatibility impact

No public Raycast API behavior changes while a Form is mounted. Action.SubmitForm still reads the current mounted snapshot, and getFormValues() still falls back to placeholders for empty or undefined field values.

How tested

  • node --test scripts/test-form-runtime-error-state-noop.mjs scripts/test-use-form-error-state-noop.mjs scripts/test-form-runtime-snapshot-cleanup.mjs
  • node scripts/test-form-runtime-snapshot-cleanup.mjs --report
  • npm run typecheck:renderer
  • Codex LSP diagnostics on form-runtime.tsx and form-runtime-context.tsx: no diagnostics found
  • Codex LSP references checked for setCurrentFormValues and clearCurrentFormSnapshot call sites

Performance evidence

Focused harness report:

  • Previous no-cleanup behavior after unmount: valueKeys=2, errorKeys=1, placeholderKeys=1, totalKeys=4, serializedBytes=1782
  • Fixed behavior before unmount: valueKeys=2, errorKeys=1, placeholderKeys=1, totalKeys=4, serializedBytes=1782
  • Fixed behavior after unmount: valueKeys=0, errorKeys=0, placeholderKeys=0, totalKeys=0, serializedBytes=43

Stack validation

Started from codex/perf-wave3-integration-stack-20260704 at commit 206eab8. npm is intentionally disabled on this Mac and delegates to pnpm; dependencies were installed with pnpm without lockfile changes, and npm run typecheck:renderer completed through that wrapper.

Replaces

None.

…perf-wave2-integration-stack-20260704

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

# Conflicts:
#	src/renderer/src/CameraExtension.tsx
…perf-wave2-integration-stack-20260704

# Conflicts:
#	src/renderer/src/raycast-api/list-runtime.tsx
…perf-wave2-integration-stack-20260704

# Conflicts:
#	scripts/bench-script-command-discovery.mjs
#	scripts/benchmark-file-search-delete-batch.mjs
#	scripts/lib/script-command-runner-harness.mjs
#	scripts/lib/ts-import.mjs
#	scripts/test-file-search-delete-batch.mjs
#	scripts/test-script-command-runner.mjs
#	src/main/file-search-index.ts
#	src/main/main.ts
…perf-wave2-integration-stack-20260704

# Conflicts:
#	scripts/lib/script-command-runner-harness.mjs
#	scripts/lib/ts-import.mjs
#	scripts/test-extension-lifecycle-sandbox.mjs
#	scripts/test-script-command-runner.mjs
#	src/main/main.ts
#	src/renderer/src/ExtensionView.tsx
…perf-wave2-integration-stack-20260704

# Conflicts:
#	.github/workflows/project-checks.yml
#	scripts/test-root-search-perf.mjs
#	src/renderer/src/CameraExtension.tsx
#	src/renderer/src/raycast-api/list-runtime.tsx
…erf-wave3-integration-stack-20260704

# Conflicts:
#	package.json
#	scripts/measure-extension-bundle-cache.mjs
#	scripts/test-icon-runtime-file-icon-cache.mjs
#	src/main/extension-runner.ts
#	src/renderer/src/components/HiddenExtensionRunners.tsx
#	src/renderer/src/raycast-api/icon-runtime-render.tsx
…/perf-wave3-integration-stack-20260704

# Conflicts:
#	scripts/test-browser-search-performance.mjs
#	scripts/test-root-search-perf.mjs
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by the clean consolidated wave4 renderer/Raycast PR: #599. That branch contains this PR's covered change on current main without the inherited broad-stack noise.

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