trunk-merge/pr-3656/b05f8e7e-d060-4efa-88a8-ce1753f3881d#3661
Closed
trunk-io[bot] wants to merge 5 commits into
Closed
trunk-merge/pr-3656/b05f8e7e-d060-4efa-88a8-ce1753f3881d#3661trunk-io[bot] wants to merge 5 commits into
trunk-io[bot] wants to merge 5 commits into
Conversation
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
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
trunk-io
Bot
deleted the
trunk-merge/pr-3656/b05f8e7e-d060-4efa-88a8-ce1753f3881d
branch
July 22, 2026 00:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.