Commit 250a884
fix(native-dom): clear node_id_mapping when nodes are removed
When `remove_node` or `replace_node_with` removes a node from the DOM,
the corresponding entry in `node_id_mapping` was not being cleared.
This left stale ElementId → NodeId mappings.
Since dioxus-core recycles ElementIds aggressively, a recycled ElementId
could find a stale mapping in `assign_node_id`, which would then call
`remove_node_if_unparented` on either:
- An already-removed node (causing panic in blitz-dom: "invalid key")
- A node still on the mutation stack waiting to be attached (corrupting
the DOM by removing nodes that should be inserted)
This fix clears the mapping immediately when nodes are removed, ensuring
the invariant: if `node_id_mapping[eid] = Some(nid)`, then `nid` is valid
in blitz-dom.1 parent ec8f31d commit 250a884
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
147 | 150 | | |
148 | 151 | | |
149 | 152 | | |
| |||
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
163 | 169 | | |
164 | 170 | | |
165 | 171 | | |
| |||
0 commit comments