From b210b2013d1ff0a5be95e58ad53ff7fdf9f65b02 Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Tue, 22 Sep 2026 15:27:39 +0300 Subject: [PATCH] Fix saving bug --- src/pages/dictionary.rs | 3 ++- src/pages/word.rs | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/dictionary.rs b/src/pages/dictionary.rs index b1db437..65c781d 100644 --- a/src/pages/dictionary.rs +++ b/src/pages/dictionary.rs @@ -371,7 +371,8 @@ impl NavigatedPage for DictionaryState { } } ExtendedWordEdited => { - return self.launch_auto_save_offset(self.selected_cell.unwrap().0); + let handle = self.word_editor.as_ref().unwrap().word_handle; + return self.launch_auto_save_offset(handle); } } diff --git a/src/pages/word.rs b/src/pages/word.rs index 2ed272d..f3443a6 100644 --- a/src/pages/word.rs +++ b/src/pages/word.rs @@ -13,7 +13,7 @@ use iced_core::Padding; pub struct WordEditor { state: AppState, - handle: EntityHandle, + pub word_handle: EntityHandle, on_delete: Option, on_edit: Option, fields: Vec, @@ -22,7 +22,7 @@ pub struct WordEditor { impl WordEditor { pub(crate) fn update(&mut self, message: WordMessage) -> Option { let dictionary = &mut self.state.dictionary.write(); - let word = dictionary.get_mut(&mut self.handle).unwrap(); + let word = dictionary.get_mut(&mut self.word_handle).unwrap(); match message { Delete => { return self.on_delete.take(); @@ -53,7 +53,7 @@ impl WordEditor { .state .dictionary .read() - .get_static(self.handle) + .get_static(self.word_handle) .unwrap(); for field in &self.fields { if !word.additional.contains_key(&field.id) { @@ -118,7 +118,7 @@ impl WordEditor { .collect::>(); Self { state, - handle, + word_handle: handle, on_delete: None, on_edit: None, fields,