fix(web): render srcdoc preview without requiring Edit (#2791)#3042
fix(web): render srcdoc preview without requiring Edit (#2791)#3042leno23 wants to merge 1 commit into
Conversation
Lazy srcdoc transport was still active after URL-load preview switched off, leaving the visible iframe on an empty activation shell until Edit forced a full srcdoc reload. Mount real artifact HTML whenever srcdoc is the active transport and remount when leaving URL-load. Fixes nexu-io#2791
There was a problem hiding this comment.
Hi @leno23! Thanks for spelling out the blank-preview path and tying it back to #2791 — the Summary and Validation are clear. One template bit before pool review: could you add the current PR template's Surface area checklist and tick the applicable box(es) for this preview rendering change? The file list is useful, but the checklist helps reviewers and release notes quickly see whether this affects UI/default behavior.
Related: #2791 is the reporter scenario this targets; #2704 and #2361/#2805 are nearby blank-preview context for reviewers to keep in mind.
mrcfps
left a comment
There was a problem hiding this comment.
@leno23 I walked through the FileViewer transport switch and the new regression coverage for sandbox-shim and Draw/srcdoc activation paths. The updated remount logic keeps the active iframe on the real srcdoc markup when URL-load turns off, which matches the bug report and closes the stale lazy-shell path. Thanks for tightening up this preview edge case. 🙌
🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.















































/claim #2791
Summary
Artifacts that route through the srcdoc transport (external
<script src>, sandbox shim, Draw/Tweaks, etc.) could stay blank because the visible iframe remained on the lazy activation shell after URL-load preview switched off. Clicking Edit forced a full srcdoc reload, which is why the page appeared only after toolbar interaction.srcDocattribute.Related: #2253 (activation race), #2361 (sandbox/localStorage blank preview).
Surface area
apps/web/src/components/FileViewer.tsxapps/web/tests/components/FileViewer.test.tsxValidation
cd apps/web && pnpm test tests/components/FileViewer.test.tsxMade with Cursor