fix(ui): clear task selection when switching lists
Switching lists rebuilt Tasks.Items from scratch but left SelectedTask pointing at a row from the previous list, so the detail pane kept showing that task even though it is not in the visible list. Drop the selection when the list actually changes; a reload of the same list (worker refresh, reconnect) keeps it so a live update never yanks the detail pane away.
This commit is contained in:
@@ -231,6 +231,12 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
|
||||
_loadCts = new CancellationTokenSource();
|
||||
var ct = _loadCts.Token;
|
||||
|
||||
// Items is rebuilt from scratch below, so a selection carried over from the previous list
|
||||
// would leave the detail pane bound to a task the visible list no longer contains. Only a
|
||||
// *different* list drops it — a reload of the same list (worker refresh, reconnect) keeps
|
||||
// the selection so a live update never yanks the detail pane away.
|
||||
var listChanged = !string.Equals(_currentList?.Id, list?.Id, StringComparison.Ordinal);
|
||||
|
||||
if (_currentList is not null)
|
||||
_currentList.PropertyChanged -= OnCurrentListPropertyChanged;
|
||||
_currentList = list;
|
||||
@@ -246,6 +252,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
|
||||
HasCompleted = false;
|
||||
ShowOpenLabel = false;
|
||||
ShowNotesRow = false;
|
||||
if (listChanged) SelectedTask = null;
|
||||
if (list is null) { IsLetClaudeVisible = false; LoadTask = Task.CompletedTask; return; }
|
||||
|
||||
HeaderTitle = list.Name;
|
||||
|
||||
Reference in New Issue
Block a user