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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user