Skip to content

fix: coalesce pending renders and preserve the active preview - #5927

Closed
0hmX wants to merge 2 commits into
mainfrom
fix/coalesce-dev-updates-20261027
Closed

0hmX wants to merge 2 commits into
mainfrom
fix/coalesce-dev-updates-20261027

Conversation

@0hmX

@0hmX 0hmX commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

0hmx@dots

When files change during a slow render, RunFrame currently invalidates the active generation immediately. Continuous edits can keep discarding completed work, and each rerender can briefly replace a completed PCB with an intermediate snapshot. The mutex also releases its lock on cancellation while the worker may still be rendering.

Keep one active render and only the newest pending request. Let a successful active render finish before starting the latest snapshot, so continuous editing makes progress and an older completion cannot overwrite a newer run. Cancellation clears queued work while retaining the worker lock until settlement. Preserve the existing preview until the replacement render finishes; initial loads still show their initial snapshot. Superseded failures are ignored while current failures remain visible and recover on the next edit.

Normalize the absent entrypoint comparison (undefined versus null) so identical file maps do not spuriously rerun, while still rerunning when the selected main component or evaluator version changes.

Validation on macOS with Bun 1.3.14:

  • Latest-task queue tests cover many pending requests, cancellation without overlapping a busy worker, and failure/recovery.
  • Extended the real React RunFrame lifecycle fixture: twenty edits during a blocked render produce exactly one follow-up execution using the final source, the current preview remains visible, and both completed runs are reported. Existing tests also cover initialization, execution/settlement/snapshot failures, identical maps, superseded errors, loading transitions, and unmount disposal.
  • The full 84-test suite passed before the final evaluator-version guard was added. The final full run passed 83/84, with one unrelated 5 s UI-fixture startup timeout while bundling; it passed in isolation alongside the updated lifecycle and queue tests (5/5). There are 331 top-level assertions plus isolated UI fixture assertions.
  • Repository formatting, TypeScript check, and standalone browser build pass.
  • Live ChatGPT in-app browser with the companion CLI fix: five rapid native TSX saves yield one completed update, the chosen view is retained, and syntax-error/atomic-save recovery shows the final 42k resistor value without a page reload. The installed eval worker was preserved byte-for-byte for this local validation.

The companion CLI PR #5612 batches filesystem changes using a bounded 250 ms trailing debounce. This scheduling fix is independent of that debounce. No circuit engine, board design, authentication, or networking behavior is changed.

Hosted validation on a95f3335abf9f59ddd66eb99e806a14199820628: Bun tests, formatting, types, and Vercel preview checks all passed. The fix reaches standard CLI installations after a runframe release is incorporated into the standalone browser bundle distributed with tscircuit; the paired patches are already active together in the tested local installation.

Automated-review follow-up: split the three queue cases into separate numbered test files to follow the repository's one-test-per-file convention. The test bodies and runtime code are unchanged; the three split tests pass locally and the current-head hosted suite passes.

@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
runframe Ready Ready Preview Oct 27, 2026 6:51pm UTC

Request Review

Comment thread tests/latest-task-queue.test.ts Resolved
@0hmX
0hmX marked this pull request as draft October 27, 2026 18:48
@0hmX
0hmX marked this pull request as ready for review October 27, 2026 18:51
@0hmX 0hmX closed this Oct 28, 2026

This branch was successfully deployed

1 active deployment
Preview — a95f3335 Deployed Oct 27, 2026 by vercel[bot]
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