Skip to content

Commit be744ef

Browse files
committed
DOM: fix double deletion in VDOM tree removal
1 parent d6e9997 commit be744ef

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

PUI/dom.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,18 @@ def sync(node, dom_parent, dom_offset, oldVDOM, newVDOM, depth=0):
230230
break # finish
231231

232232
# Step 4. trim removed trail
233+
if DEBUG:
234+
print(f"{(depth+1)*' '}S4. TRIM")
233235
nl = len(newVDOM)
236+
if DEBUG:
237+
print(f"{(depth+1)*' '}S4. TRIM", f"dom_offset={dom_offset}", len(oldVDOM), "=>", len(newVDOM))
234238
while len(oldVDOM) > nl:
235239
old = oldVDOM.pop(nl)
240+
print(f"{(depth+2)*' '}", f"key={old.key} virtual={old.pui_virtual} children={len(old.children)}")
236241
oldVMap.pop(nl)
237242
nodes = dom_remove_node(dom_parent, dom_offset + nl, old)
238243
dom_children_num -= len([n for n in nodes if not n.pui_virtual and not n.pui_outoforder])
239-
toBeDeleted.extend(nodes)
244+
toBeDeleted.append(old)
240245

241246
for c in newVDOM:
242247
c.postUpdate()

0 commit comments

Comments
 (0)