fix: Fix panic when select priority
This commit is contained in:
@@ -262,7 +262,9 @@ impl TaskDetailModal {
|
||||
Dropdown::new("task-edit-status")
|
||||
.items(status_items)
|
||||
.on_select(Arc::new(move |index, _item, cx| {
|
||||
cx.update_entity(&modal_entity, |modal, cx| {
|
||||
let modal_entity = modal_entity.clone();
|
||||
cx.defer(move |cx| {
|
||||
let _ = modal_entity.update(cx, |modal, cx| {
|
||||
modal.state.form.status = match index {
|
||||
0 => task::TaskStatus::Pending,
|
||||
1 => task::TaskStatus::Completed,
|
||||
@@ -271,6 +273,7 @@ impl TaskDetailModal {
|
||||
};
|
||||
cx.notify();
|
||||
});
|
||||
});
|
||||
}))
|
||||
})
|
||||
};
|
||||
@@ -287,7 +290,9 @@ impl TaskDetailModal {
|
||||
Dropdown::new("task-edit-priority")
|
||||
.items(priority_items)
|
||||
.on_select(Arc::new(move |index, _item, cx| {
|
||||
cx.update_entity(&modal_entity, |modal, cx| {
|
||||
let modal_entity = modal_entity.clone();
|
||||
cx.defer(move |cx| {
|
||||
let _ = modal_entity.update(cx, |modal, cx| {
|
||||
modal.state.form.priority = match index {
|
||||
0 => task::TaskPriority::High,
|
||||
1 => task::TaskPriority::Medium,
|
||||
@@ -297,6 +302,7 @@ impl TaskDetailModal {
|
||||
};
|
||||
cx.notify();
|
||||
});
|
||||
});
|
||||
}))
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user