fix hydration

This commit is contained in:
Evan Almloff committed 2024-01-18 10:47:10 -06:00
1 parent d20422bb0f
commit 694bef0d93
8 files changed
+76 -21

No files matched your search

@@ -87,7 +87,6 @@ mod js {
templates[tmpl_id] = nodes;
}
export function hydrate(ids) {
console.log("hydrating", ids);
const hydrateNodes = document.querySelectorAll('[data-node-hydration]');
for (let i = 0; i < hydrateNodes.length; i++) {
const hydrateNode = hydrateNodes[i];
@@ -95,7 +94,6 @@ mod js {
const split = hydration.split(',');
const id = ids[parseInt(split[0])];
nodes[id] = hydrateNode;
console.log("hydrating node", hydrateNode, id);
if (split.length > 1) {
hydrateNode.listening = split.length - 1;
hydrateNode.setAttribute('data-dioxus-id', id);
@@ -104,7 +102,6 @@ mod js {
const split2 = listener.split(':');
const event_name = split2[0];
const bubbles = split2[1] === '1';
console.log("hydrating listener", event_name, bubbles);
listeners.create(event_name, hydrateNode, bubbles);
}
}
@@ -118,7 +115,6 @@ mod js {
const id = currentNode.textContent;
const split = id.split('node-id');
if (split.length > 1) {
console.log("hydrating text", currentNode.nextSibling, id);
nodes[ids[parseInt(split[1])]] = currentNode.nextSibling;
}
currentNode = treeWalker.nextNode();