@yannosay/sinth 1.12.2 → 1.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/compiler.js +20 -1
- package/package.json +1 -1
package/dist/core/compiler.js
CHANGED
|
@@ -729,7 +729,26 @@ function renderIfBlock(ifBlock, ctx, params, depth) {
|
|
|
729
729
|
const bodyHTML = ifBlock.body.map(c => renderChild(c, ctx, params, depth + 1)).join("");
|
|
730
730
|
const elseHTML = (ifBlock.elseBody ?? []).map(c => renderChild(c, ctx, params, depth + 1)).join("");
|
|
731
731
|
let replaceAttr = "";
|
|
732
|
-
|
|
732
|
+
const hasStatefulComp = ifBlock.body.some(c => {
|
|
733
|
+
if (c.kind !== "use")
|
|
734
|
+
return false;
|
|
735
|
+
const u = c;
|
|
736
|
+
if (u.name === "__IF_ROOT__")
|
|
737
|
+
return false;
|
|
738
|
+
if (ctx.customEls.has(u.name))
|
|
739
|
+
return true;
|
|
740
|
+
return u.attrs.some(a => a.name === "bind" || a.name === "model" || a.name === "fullscreenSync");
|
|
741
|
+
}) || (ifBlock.elseBody ?? []).some(c => {
|
|
742
|
+
if (c.kind !== "use")
|
|
743
|
+
return false;
|
|
744
|
+
const u = c;
|
|
745
|
+
if (u.name === "__IF_ROOT__")
|
|
746
|
+
return false;
|
|
747
|
+
if (ctx.customEls.has(u.name))
|
|
748
|
+
return true;
|
|
749
|
+
return u.attrs.some(a => a.name === "bind" || a.name === "model" || a.name === "fullscreenSync");
|
|
750
|
+
});
|
|
751
|
+
let persistAttr = (ifBlock.persist || hasStatefulComp) ? ` data-sinth-if-persist="true"` : "";
|
|
733
752
|
const firstComp = ifBlock.body.find(c => c.kind === "use");
|
|
734
753
|
if (firstComp) {
|
|
735
754
|
const idAttr = firstComp.attrs.find(a => a.name === "id");
|
package/package.json
CHANGED