Skip to content

Commit 1d898d0

Browse files
committed
fix: multiple renders same runtime id
1 parent 97e9ae8 commit 1d898d0

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

.changeset/angry-things-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@marko/runtime-tags": patch
3+
---
4+
5+
Fix issue with multiple renders into the same runtime.

packages/runtime-tags/src/html/inlined-runtimes.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export const WALKER_RUNTIME_CODE = MARKO_DEBUG
2-
? /* js */ `((runtimeId) => (
3-
(self[runtimeId] = (
2+
? /* js */ `((runtimeId) => (self[runtimeId] || (self[runtimeId] = (
43
renderId,
54
prefix = runtimeId + renderId,
65
prefixLen = prefix.length,
@@ -34,12 +33,12 @@ export const WALKER_RUNTIME_CODE = MARKO_DEBUG
3433
}
3534
}
3635
},
37-
})),
38-
self[runtimeId]
39-
))`
40-
: `(e=>(self[e]=(l,d=e+l,f=d.length,o={},n=[],s=document,t=s.createTreeWalker(s,129))=>s=self[e][l]={i:d,d:s,l:o,v:n,x(){},w(e,l,x){for(;e=t.nextNode();)s.x(l=(l=e.data)&&!l.indexOf(d)&&(o[x=l.slice(f+1)]=e,l[f]),x,e),l>"#"&&n.push(e)}},self[e]))`;
36+
})
37+
)))`
38+
: `(e=>(self[e]||(self[e]=(o,l=e+o,d=l.length,n={},f=[],s=document,a=s.createTreeWalker(s,129))=>s=self[e][o]={i:l,d:s,l:n,v:f,x(){},w(e,o,i){for(;e=a.nextNode();)s.x(o=(o=e.data)&&!o.indexOf(l)&&(n[i=o.slice(d+1)]=e,o[d]),i,e),o>"#"&&f.push(e)}})))`;
4139
export const REORDER_RUNTIME_CODE = MARKO_DEBUG
4240
? /* js */ `((runtime) => {
41+
if (runtime.j) return;
4342
let onNextSibling,
4443
placeholder,
4544
nextSibling,
@@ -93,4 +92,4 @@ runtime.x = (op, id, node, start, placeholderCallback) => {
9392
}
9493
};
9594
})`
96-
: `(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})`;
95+
: `(e=>{if(e.j)return;let i,o,l,r={},t=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(c,d,n,a,g)=>{"#"==c?(r[d]=o).i++:n==l&&i(),"T"==n.tagName&&(d=n.getAttribute(e.i))&&((a=e.l["^"+d])&&(r[d]={i:1,c(i=e.l[d]||n){for(;(l=i.previousSibling||a).remove(),a!=l;);t(i,n)}}),l=n.nextSibling,o=r[d],i=()=>{a||t(e.l[d],n),--o.i||o.c()},(c=e.j[d])&&(g=o.c,o.c=()=>g()+c(e.r)))}})`;

0 commit comments

Comments
 (0)