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 => {
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> {
state: AppState,
handle: EntityHandle<WordData>,
pub word_handle: EntityHandle<WordData>,
on_delete: Option<Message>,
on_edit: Option<Message>,
fields: Vec<CustomField>,
@@ -22,7 +22,7 @@ pub struct WordEditor<Message> {
impl<Message> WordEditor<Message> {
pub(crate) fn update(&mut self, message: WordMessage) -> Option<Message> {
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<Message> WordEditor<Message> {
.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<Message> WordEditor<Message> {
.collect::<Vec<_>>();
Self {
state,
handle,
word_handle: handle,
on_delete: None,
on_edit: None,
fields,