From 3f0262c50a795dc763e9528a88ec8b4da3ce4cd8 Mon Sep 17 00:00:00 2001 From: Ignacio Perez Date: Sun, 4 Jan 2026 12:12:23 -0300 Subject: [PATCH] fix(modal): status and priority dropdowns save selection on mouse click Fixed an issue where selecting a status or priority option with the mouse did not save the value in edit mode. Added on_select handlers to both dropdowns to update the form state immediately when clicked. --- src/view/task_detail_modal/mod.rs | 40 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/view/task_detail_modal/mod.rs b/src/view/task_detail_modal/mod.rs index d8416a7..1612145 100644 --- a/src/view/task_detail_modal/mod.rs +++ b/src/view/task_detail_modal/mod.rs @@ -256,7 +256,24 @@ impl TaskDetailModal { DropdownItem::new("Completed"), DropdownItem::new("Deleted"), ]; - let status_dropdown = cx.new(|_cx| Dropdown::new("task-edit-status").items(status_items)); + let status_dropdown = { + let modal_entity = modal_entity.clone(); + cx.new(|_cx| { + Dropdown::new("task-edit-status") + .items(status_items) + .on_select(Arc::new(move |index, _item, cx| { + cx.update_entity(&modal_entity, |modal, cx| { + modal.state.form.status = match index { + 0 => task::TaskStatus::Pending, + 1 => task::TaskStatus::Completed, + 2 => task::TaskStatus::Deleted, + _ => task::TaskStatus::Pending, + }; + cx.notify(); + }); + })) + }) + }; let priority_items = vec![ DropdownItem::new("High"), @@ -264,8 +281,25 @@ impl TaskDetailModal { DropdownItem::new("Low"), DropdownItem::new("None"), ]; - let priority_dropdown = - cx.new(|_cx| Dropdown::new("task-edit-priority").items(priority_items)); + let priority_dropdown = { + let modal_entity = modal_entity.clone(); + cx.new(|_cx| { + Dropdown::new("task-edit-priority") + .items(priority_items) + .on_select(Arc::new(move |index, _item, cx| { + cx.update_entity(&modal_entity, |modal, cx| { + modal.state.form.priority = match index { + 0 => task::TaskPriority::High, + 1 => task::TaskPriority::Medium, + 2 => task::TaskPriority::Low, + 3 => task::TaskPriority::None, + _ => task::TaskPriority::None, + }; + cx.notify(); + }); + })) + }) + }; let entities = ModalEntities { annotation_input,