Fix component caching: move data-components check before empty-text guard
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m27s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m27s
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;
|
s._sxProcessed = true;
|
||||||
|
|
||||||
var text = s.textContent;
|
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")) {
|
if (s.hasAttribute("data-components")) {
|
||||||
var hash = s.getAttribute("data-hash");
|
var hash = s.getAttribute("data-hash");
|
||||||
if (hash) {
|
if (hash) {
|
||||||
@@ -1395,6 +1394,8 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!text || !text.trim()) continue;
|
||||||
|
|
||||||
// data-mount="<selector>": render into target
|
// data-mount="<selector>": render into target
|
||||||
var mountSel = s.getAttribute("data-mount");
|
var mountSel = s.getAttribute("data-mount");
|
||||||
if (mountSel) {
|
if (mountSel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user