From 43391850e0501eca05f6c6604a3ba67811d5d84c Mon Sep 17 00:00:00 2001 From: Emilia Date: Tue, 13 Jun 2023 17:12:25 -0400 Subject: [PATCH] Purge transfers on plate deletion --- src/components/states.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/states.rs b/src/components/states.rs index 2765cbe..83045c5 100644 --- a/src/components/states.rs +++ b/src/components/states.rs @@ -39,7 +39,7 @@ impl Store for MainState { } impl MainState { - pub fn _purge_transfers(&mut self) { + fn purge_transfers(&mut self) { // Removes any transfers for which the associated plates are gone self.transfers.retain(|tr| { self.source_plates @@ -67,6 +67,7 @@ impl MainState { .position(|spi| spi.get_uuid() == id) { self.source_plates.swap_remove(index); + self.purge_transfers(); } if let Some(index) = self .destination_plates @@ -74,6 +75,7 @@ impl MainState { .position(|dpi| dpi.get_uuid() == id) { self.destination_plates.swap_remove(index); + self.purge_transfers(); } } pub fn rename_plate(&mut self, id: Uuid, new_name: &str) {