From 39f61eddd65d9070759ee37407259d1b41653b68 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 2 Mar 2026 01:02:04 +0000 Subject: [PATCH] Fix component caching: move data-components check before empty-text guard When server omits component source (cache hit), the script tag has empty textContent. The early `if (!text.trim()) continue` was skipping the data-components handler entirely, so components never loaded from localStorage. Co-Authored-By: Claude Opus 4.6 --- shared/static/scripts/sx.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/static/scripts/sx.js b/shared/static/scripts/sx.js index 43ac749..0085fb5 100644 --- a/shared/static/scripts/sx.js +++ b/shared/static/scripts/sx.js @@ -1340,9 +1340,8 @@ s._sxProcessed = true; var text = s.textContent; - if (!text || !text.trim()) continue; - // data-components: load as component definitions (with localStorage caching) + // data-components: check before empty-text guard (may load from localStorage) if (s.hasAttribute("data-components")) { var hash = s.getAttribute("data-hash"); if (hash) { @@ -1395,6 +1394,8 @@ continue; } + if (!text || !text.trim()) continue; + // data-mount="": render into target var mountSel = s.getAttribute("data-mount"); if (mountSel) {