diff --git a/src/tree.rs b/src/tree.rs index f6f78cd..b0c5968 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -3,6 +3,8 @@ use crate::icon::{Icon, IconName}; use crate::Intent; pub use id_tree::*; use std::cell::{Ref, RefCell, RefMut}; +use std::collections::hash_map::DefaultHasher; +use std::hash::{Hash, Hasher}; use std::rc::Rc; use yew::prelude::*; @@ -176,6 +178,9 @@ impl Tree { .map(move |x| x.reform(move |event| (node_id.clone(), event))) }; let inner_nodes = self.render_children(node_id, depth + 1); + let mut hasher = DefaultHasher::new(); + node_id.hash(&mut hasher); + let key = hasher.finish(); html! { Tree { on_expand=on_expand onclick=onclick depth=depth + key=key > {inner_nodes}