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 <noreply@anthropic.com>
This commit is contained in:
2026-03-02 01:02:04 +00:00
parent 5436dfe76c
commit 39f61eddd6

View File

@@ -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="<selector>": render into target
var mountSel = s.getAttribute("data-mount");
if (mountSel) {