Assembly: don't track element list when inserting
Calling `try_insert_element` or `insert_new_element` in a responsive context shouldn't make the context track `elements_by_id`.
This commit is contained in:
parent
4f8f36053f
commit
721a8716d4
@ -49,7 +49,7 @@ impl Assembly {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn try_insert_element(&self, elt: Element) -> bool {
|
pub fn try_insert_element(&self, elt: Element) -> bool {
|
||||||
let can_insert = self.elements_by_id.with(
|
let can_insert = self.elements_by_id.with_untracked(
|
||||||
|elts_by_id| !elts_by_id.contains_key(&elt.id)
|
|elts_by_id| !elts_by_id.contains_key(&elt.id)
|
||||||
);
|
);
|
||||||
if can_insert {
|
if can_insert {
|
||||||
@ -62,7 +62,7 @@ impl Assembly {
|
|||||||
// find the next unused identifier in the default sequence
|
// find the next unused identifier in the default sequence
|
||||||
let mut id_num = 1;
|
let mut id_num = 1;
|
||||||
let mut id = format!("sphere{}", id_num);
|
let mut id = format!("sphere{}", id_num);
|
||||||
while self.elements_by_id.with(
|
while self.elements_by_id.with_untracked(
|
||||||
|elts_by_id| elts_by_id.contains_key(&id)
|
|elts_by_id| elts_by_id.contains_key(&id)
|
||||||
) {
|
) {
|
||||||
id_num += 1;
|
id_num += 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user