Fix saving bug

This commit is contained in:
micialware committed 2026-09-22 15:27:39 +03:00
1 parent 48cd68d1c7
commit b210b2013d
2 files changed
+6 -5

No files matched your search

+2 -1
View File
@@ -371,7 +371,8 @@ impl NavigatedPage<DictionaryMessage> for DictionaryState {
} }
} }
ExtendedWordEdited => { 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);
} }
} }
+4 -4
View File
@@ -13,7 +13,7 @@ use iced_core::Padding;
pub struct WordEditor<Message> { pub struct WordEditor<Message> {
state: AppState, state: AppState,
handle: EntityHandle<WordData>, pub word_handle: EntityHandle<WordData>,
on_delete: Option<Message>, on_delete: Option<Message>,
on_edit: Option<Message>, on_edit: Option<Message>,
fields: Vec<CustomField>, fields: Vec<CustomField>,
@@ -22,7 +22,7 @@ pub struct WordEditor<Message> {
impl<Message> WordEditor<Message> { impl<Message> WordEditor<Message> {
pub(crate) fn update(&mut self, message: WordMessage) -> Option<Message> { pub(crate) fn update(&mut self, message: WordMessage) -> Option<Message> {
let dictionary = &mut self.state.dictionary.write(); 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 { match message {
Delete => { Delete => {
return self.on_delete.take(); return self.on_delete.take();
@@ -53,7 +53,7 @@ impl<Message> WordEditor<Message> {
.state .state
.dictionary .dictionary
.read() .read()
.get_static(self.handle) .get_static(self.word_handle)
.unwrap(); .unwrap();
for field in &self.fields { for field in &self.fields {
if !word.additional.contains_key(&field.id) { if !word.additional.contains_key(&field.id) {
@@ -118,7 +118,7 @@ impl<Message> WordEditor<Message> {
.collect::<Vec<_>>(); .collect::<Vec<_>>();
Self { Self {
state, state,
handle, word_handle: handle,
on_delete: None, on_delete: None,
on_edit: None, on_edit: None,
fields, fields,