From 6727cc4e9dc5b4dd225f61937da698c9377ff6b0 Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Mon, 13 Apr 2026 15:04:19 +0200 Subject: [PATCH] refactor(ui): harden double-click edit handlers Remove redundant SelectedList/SelectedTask assignments (single-tap already updated selection via binding) and CanExecute guards (always true for unconditional [RelayCommand]). Set e.Handled = true to stop DoubleTapped from bubbling to the ListBox. Co-Authored-By: Claude Sonnet 4.6 --- src/ClaudeDo.Ui/Views/MainWindow.axaml.cs | 7 +++---- src/ClaudeDo.Ui/Views/TaskListView.axaml.cs | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs b/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs index e227cdf..309b71a 100644 --- a/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs +++ b/src/ClaudeDo.Ui/Views/MainWindow.axaml.cs @@ -20,12 +20,11 @@ public partial class MainWindow : Window private void OnListItemDoubleTapped(object? sender, TappedEventArgs e) { - if (sender is Control c && c.DataContext is ListItemViewModel item + if (sender is Control c && c.DataContext is ListItemViewModel && DataContext is MainWindowViewModel vm) { - vm.SelectedList = item; - if (vm.EditListCommand.CanExecute(null)) - vm.EditListCommand.Execute(null); + vm.EditListCommand.Execute(null); + e.Handled = true; } } } diff --git a/src/ClaudeDo.Ui/Views/TaskListView.axaml.cs b/src/ClaudeDo.Ui/Views/TaskListView.axaml.cs index d8bdda7..0dfd12e 100644 --- a/src/ClaudeDo.Ui/Views/TaskListView.axaml.cs +++ b/src/ClaudeDo.Ui/Views/TaskListView.axaml.cs @@ -13,12 +13,11 @@ public partial class TaskListView : UserControl private void OnTaskItemDoubleTapped(object? sender, TappedEventArgs e) { - if (sender is Control c && c.DataContext is TaskItemViewModel item + if (sender is Control c && c.DataContext is TaskItemViewModel && DataContext is TaskListViewModel vm) { - vm.SelectedTask = item; - if (vm.EditTaskCommand.CanExecute(null)) - vm.EditTaskCommand.Execute(null); + vm.EditTaskCommand.Execute(null); + e.Handled = true; } } }