Skip to content

fix: clear form runtime snapshots on unmount#596

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

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

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Added guarded cleanup for Form runtime module-global value, error, and placeholder snapshots when a mounted Form unmounts.
  • Kept the latest published snapshot objects in a Form ref so cleanup can clear the correct retained objects without touching newer snapshots.
  • Added a focused Node harness for mounted/update/unmount snapshot retention metrics and placeholder fallback behavior.

Why

Unmounted Form views could leave the last submitted values, errors, placeholders, and associated object graphs reachable through the Action.SubmitForm snapshot globals.

Compatibility impact

No public Raycast API behavior changes while a Form is mounted. Existing Action.SubmitForm reads still use the same global snapshots, and getFormValues() still falls back to placeholders for blank or missing values.

How tested

  • node --test scripts/test-form-runtime-snapshot-cleanup.mjs scripts/test-form-runtime-error-state-noop.mjs scripts/test-use-form-error-state-noop.mjs
  • npm run typecheck:renderer
  • Codex LSP diagnostics on src/renderer/src/raycast-api/form-runtime.tsx and src/renderer/src/raycast-api/form-runtime-context.tsx: no errors

Performance evidence

  • node scripts/test-form-runtime-snapshot-cleanup.mjs --report
  • Before unmount: 2 value keys, 1 error key, 2 placeholder keys, 5 total retained keys, 2220 retained serialized bytes.
  • After unmount: 0 value keys, 0 error keys, 0 placeholder keys, 0 total retained keys, 0 retained serialized bytes.

Stack validation

Started from codex/perf-wave3-integration-stack-20260704 at commit 206eab8. Branch: codex/form-runtime-snapshot-cleanup. Commit: 78560e6.

Replaces

No prior PR. Implements the perf wave 4 child scope from source thread 019f2d44-7d62-7ac2-8096-b318f6d4a671.

…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