Skip to content

trunk-merge/pr-3656/b05f8e7e-d060-4efa-88a8-ce1753f3881d#3661

Closed
trunk-io[bot] wants to merge 5 commits into
mainfrom
trunk-merge/pr-3656/b05f8e7e-d060-4efa-88a8-ce1753f3881d
Closed

trunk-merge/pr-3656/b05f8e7e-d060-4efa-88a8-ce1753f3881d#3661
trunk-io[bot] wants to merge 5 commits into
mainfrom
trunk-merge/pr-3656/b05f8e7e-d060-4efa-88a8-ce1753f3881d

Conversation

@trunk-io

@trunk-io trunk-io Bot commented Jul 22, 2026

Copy link
Copy Markdown
Trunk Merge Pull Request Banner

This pull request was created and is being managed by Trunk Merge.

This pull request is based on the main branch at SHA b057bfb99fb9940041df6d46384857bad3445e53.

See more details here.

When CI completes, this pull request will be closed automatically.

Pull Requests Being Tested

This pull request is testing the changes from pull request 3656.

raquelmsmith and others added 5 commits July 21, 2026 12:09
Fix a warm-iframe-pool mount race that left deep-linked canvases blank
until a hard refresh, and add a manual Refresh action to the canvas menu.

The pool only shows a canvas once its slot has a measured on-screen rect.
The placeholder measured that rect in a layout effect but created the slot
in a *passive* effect that ran later, so the first measurement was dropped
(setRect no-ops with no slot). On a settled layout no follow-up re-measure
fired, so the rect stayed null and the iframe never became visible; a hard
refresh only worked because the still-settling layout triggered a later
re-measure. Registering the slot in a layout effect (before the measure)
populates the rect deterministically on first commit.

Also wires the already-scaffolded refresh path (canvasRefreshStore nonce ->
srcDoc reload) to a "Refresh" item in the canvas options menu, invalidating
the host-side read cache so data queries re-run.

Generated-By: PostHog Code
Task-Id: bbcfbcab-0cad-4754-a22e-7d1ee4f956f8
Deterministic regression test for the warm-frame mount race: with the
jsdom ResizeObserver stub (which never fires), the placeholder must
capture its slot rect from the synchronous on-mount measure. Fails when
the slot is registered in a passive effect (rect stays null), passes with
the layout-effect registration.

Generated-By: PostHog Code
Task-Id: bbcfbcab-0cad-4754-a22e-7d1ee4f956f8
Refresh previously only reloaded the iframe's document (via a srcDoc
nonce) while keeping the same element, React component, and pool slot —
so it couldn't recover from a wedged host-side/pool state (e.g. the kind
of mount race that hid deep-linked canvases).

Replace that with a true remount: a per-slot "remount generation" in the
frame store, folded into the frame's React key. Bumping it tears down and
recreates the slot's iframe element (fresh document, fresh in-iframe app,
fresh host-side listener). The generation is keyed by slot index and only
bumped by an explicit Refresh, so reassigning a slot to another canvas on
navigation leaves the key unchanged and still reuses the warm iframe.

Removes the now-redundant srcDoc-nonce reload path (canvasRefreshStore
and the refreshKey plumbing through the placeholder/host/canvas).

Generated-By: PostHog Code
Task-Id: bbcfbcab-0cad-4754-a22e-7d1ee4f956f8
Generated-By: PostHog Code
Task-Id: bbcfbcab-0cad-4754-a22e-7d1ee4f956f8
@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit e13c239.

@trunk-io trunk-io Bot closed this Jul 22, 2026
@trunk-io
trunk-io Bot deleted the trunk-merge/pr-3656/b05f8e7e-d060-4efa-88a8-ce1753f3881d branch July 22, 2026 00:32
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