Linked Designs: fix re-render wiping the resolved preview

renderResolved had an `if (!el.isConnected) return` guard meant to
catch the async path resuming after the layer was removed. But
renderLayers() creates `el` via document.createElement and only
appends it to the overlay *after* renderDesignObjectIntoElement
runs (line 14442). On the synchronous peek-hit path, that meant
the guard fired on every re-render — wiping the layer every time
the canvas re-rendered after the cache warmed.

Move the guard out of renderResolved (the sync caller doesn't
need it — fitWrap is a descendant of el either way, and the
caller will append el right after this function returns) and
keep it in the async closure (where it's actually needed,
because by the time the await resumes the old el may have been
discarded by a subsequent render).
This commit is contained in:
thePR0M3TH3AN committed 2026-05-31 17:33:33 -04:00
1 parent 7e2cd2ca0b
commit a8f7163050
1 file changed
+4 -1
+4 -1
View File
@@ -10773,8 +10773,11 @@
}
if (key) el.dataset.linkedKey = key;
// Synchronous paint helper. Callers from the async path must
// guard against el having been detached between the await and
// here; the synchronous peek-hit path calls this before el is
// even appended to the overlay, so don't guard inside.
const renderResolved = (payload) => {
if (!el.isConnected) return; // host re-rendered while we fetched
fitWrap.innerHTML = '';
try {
renderDesignPayloadPreview(fitWrap, payload, { compact: true, transparentPixelArt: true });