@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.
@@ -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
- let persistAttr = (ifBlock.persist || hasComp) ? ` data-sinth-if-persist="true"` : "";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yannosay/sinth",
3
- "version": "1.12.2",
3
+ "version": "1.12.3",
4
4
  "description": "A declarative & reactive language that compiles to pure HTML, CSS, and JavaScript.",
5
5
  "author": "Yannosay Productions",
6
6
  "license": "AGPL-3.0",