Compare commits

..

No commits in common. "outline-update-fix" and "main" have entirely different histories.

3 changed files with 7 additions and 16 deletions

View File

@ -148,9 +148,6 @@ pub fn AddRemove() -> View {
assembly.elements_by_id.update(|elts_by_id| elts_by_id.clear());
state.selection.update(|sel| sel.clear());
// increment assembly serial number
state.assembly_serial.set_fn_silent(|serial| serial.wrapping_add(1));
// load assembly
match name.as_str() {
"general" => load_gen_assemb(assembly),

View File

@ -15,7 +15,6 @@ use outline::Outline;
#[derive(Clone)]
struct AppState {
assembly: Assembly,
assembly_serial: Signal<u32>,
selection: Signal<FxHashSet<ElementKey>>
}
@ -23,7 +22,6 @@ impl AppState {
fn new() -> AppState {
AppState {
assembly: Assembly::new(),
assembly_serial: create_signal(1),
selection: create_signal(FxHashSet::default())
}
}

View File

@ -180,15 +180,11 @@ pub fn Outline() -> View {
// list the elements alphabetically by ID
let element_list = state.assembly.elements.map(
move |elts| {
let asm_serial = state.assembly_serial.get_untracked();
elts
.clone()
.into_iter()
.sorted_by_key(|(_, elt)| elt.id.clone())
.map(|(key, elt)| (asm_serial, key, elt))
.collect()
}
|elts| elts
.clone()
.into_iter()
.sorted_by_key(|(_, elt)| elt.id.clone())
.collect()
);
view! {
@ -201,10 +197,10 @@ pub fn Outline() -> View {
) {
Keyed(
list=element_list,
view=|(_, key, elt)| view! {
view=|(key, elt)| view! {
ElementOutlineItem(key=key, element=elt)
},
key=|(asm_serial, key, _)| (asm_serial.clone(), key.clone())
key=|(key, _)| key.clone()
)
}
}