aboutsummaryrefslogtreecommitdiff
path: root/priv/static/lustre-server-component.mjs
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-05-18 09:54:24 +0100
committerHayleigh Thompson <me@hayleigh.dev>2024-05-18 09:54:24 +0100
commit8f40ee6c74d14c2699777ad175374eecb2b109c3 (patch)
tree3e8f9e04f7e6487320f4b7d948da9c08057268d5 /priv/static/lustre-server-component.mjs
parent81ccdd9641b07727249bcdd5d4346b4e097b2dad (diff)
downloadlustre-8f40ee6c74d14c2699777ad175374eecb2b109c3.tar.gz
lustre-8f40ee6c74d14c2699777ad175374eecb2b109c3.zip
:bug: Fixed a bug where unordered patches would cause runtime errors.
Diffstat (limited to 'priv/static/lustre-server-component.mjs')
-rw-r--r--priv/static/lustre-server-component.mjs5
1 files changed, 4 insertions, 1 deletions
diff --git a/priv/static/lustre-server-component.mjs b/priv/static/lustre-server-component.mjs
index 239addc..f1a821c 100644
--- a/priv/static/lustre-server-component.mjs
+++ b/priv/static/lustre-server-component.mjs
@@ -46,6 +46,8 @@ function morph(prev, next, dispatch, isComponent = false) {
stack.unshift({ prev: prev2, next: fragmentElement, parent });
prev2 = prev2?.nextSibling;
});
+ } else if (next2.subtree !== void 0) {
+ stack.push({ prev: prev2, next: next2, parent });
}
}
return out;
@@ -129,6 +131,8 @@ function createElementNode({ prev, next, dispatch, stack }) {
const value = attr[1];
if (attr.as_property) {
el2[name] = value;
+ if (canMorph)
+ prevAttributes.delete(name);
} else if (name.startsWith("on")) {
const eventName = name.slice(2);
const callback = dispatch(value);
@@ -286,7 +290,6 @@ function getDeepChild(el2, path) {
let rest;
let child = el2;
while ([n, ...rest] = path, n !== void 0) {
- console.log({ n, rest, child, path });
child = child.childNodes.item(n);
path = rest;
}