Skip to content

The design language that makes your AI harness better at design.

JavaScript

fix(live): variant observer detects wrappers added as descendants

Paul Bakaus43103524234f
diff --git a/.agents/skills/impeccable/scripts/live-browser.js b/.agents/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.agents/skills/impeccable/scripts/live-browser.js
+++ b/.agents/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.claude/skills/impeccable/scripts/live-browser.js b/.claude/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.claude/skills/impeccable/scripts/live-browser.js
+++ b/.claude/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.cursor/skills/impeccable/scripts/live-browser.js b/.cursor/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.cursor/skills/impeccable/scripts/live-browser.js
+++ b/.cursor/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.gemini/skills/impeccable/scripts/live-browser.js b/.gemini/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.gemini/skills/impeccable/scripts/live-browser.js
+++ b/.gemini/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.github/skills/impeccable/scripts/live-browser.js b/.github/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.github/skills/impeccable/scripts/live-browser.js
+++ b/.github/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.kiro/skills/impeccable/scripts/live-browser.js b/.kiro/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.kiro/skills/impeccable/scripts/live-browser.js
+++ b/.kiro/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.opencode/skills/impeccable/scripts/live-browser.js b/.opencode/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.opencode/skills/impeccable/scripts/live-browser.js
+++ b/.opencode/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.pi/skills/impeccable/scripts/live-browser.js b/.pi/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.pi/skills/impeccable/scripts/live-browser.js
+++ b/.pi/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.rovodev/skills/impeccable/scripts/live-browser.js b/.rovodev/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.rovodev/skills/impeccable/scripts/live-browser.js
+++ b/.rovodev/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.trae-cn/skills/impeccable/scripts/live-browser.js b/.trae-cn/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.trae-cn/skills/impeccable/scripts/live-browser.js
+++ b/.trae-cn/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/.trae/skills/impeccable/scripts/live-browser.js b/.trae/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/.trae/skills/impeccable/scripts/live-browser.js
+++ b/.trae/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}
diff --git a/source/skills/impeccable/scripts/live-browser.js b/source/skills/impeccable/scripts/live-browser.js
index 78b58180e..82afa6b61 100644
--- a/source/skills/impeccable/scripts/live-browser.js
+++ b/source/skills/impeccable/scripts/live-browser.js
@@ -2011,7 +2011,16 @@
for (const m of mutations) {
if (m.target.closest?.('[data-impeccable-variants]')) { dominated = true; break; }
for (const n of m.addedNodes) {
- if (n.nodeType === 1 && (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant)) {
+ if (n.nodeType !== 1) continue;
+ // Direct hit: the added node itself is the wrapper or a variant.
+ if (n.dataset?.impeccableVariants || n.dataset?.impeccableVariant) {
+ dominated = true; break;
+ }
+ // Subtree hit: framework HMR (notably SvelteKit) sometimes replaces
+ // a whole subtree where the wrapper is a descendant of the added
+ // node. Without this check, the observer ignores those mutations
+ // and the session stays in GENERATING forever.
+ if (n.querySelector?.('[data-impeccable-variants],[data-impeccable-variant]')) {
dominated = true; break;
}
}