Merge claudedo/181d4abf368046b99bd57d5e2a7ab97a

This commit is contained in:
mika kuns
2026-08-05 09:27:33 +02:00
4 changed files with 274 additions and 3 deletions
@@ -237,6 +237,12 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
// the selection so a live update never yanks the detail pane away.
var listChanged = !string.Equals(_currentList?.Id, list?.Id, StringComparison.Ordinal);
// A same-list reload (triggered by OnWorkerTaskUpdated's full-reload branches) rebuilds
// every row from scratch. Reusing the previous instances by id — instead of handing back
// brand new ones — keeps SelectedTask (and the bound DetailsIslandViewModel.Task) pointed
// at a live row instead of an orphan that never receives another update.
var reusable = listChanged ? null : Items.ToDictionary(r => r.Id);
if (_currentList is not null)
_currentList.PropertyChanged -= OnCurrentListPropertyChanged;
_currentList = list;
@@ -261,10 +267,11 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
IsMyDayList = list.Id == "smart:my-day";
IsLetClaudeVisible = list.Kind == ListKind.User && !string.IsNullOrWhiteSpace(list.WorkingDir);
LoadTask = LoadForListAsync(list, ct);
LoadTask = LoadForListAsync(list, ct, reusable);
}
private async Task LoadForListAsync(ListNavItemViewModel list, CancellationToken ct)
private async Task LoadForListAsync(
ListNavItemViewModel list, CancellationToken ct, Dictionary<string, TaskRowViewModel>? reusable)
{
try
{
@@ -292,7 +299,16 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
var showListChip = list.Kind == ListKind.Virtual;
foreach (var t in filteredList)
{
var row = TaskRowViewModel.FromEntity(t);
TaskRowViewModel row;
if (reusable is not null && reusable.TryGetValue(t.Id, out var existing))
{
row = existing;
row.UpdateFromEntity(t);
}
else
{
row = TaskRowViewModel.FromEntity(t);
}
row.ShowListChip = showListChip;
row.HasInteractiveSession = _interactiveSessionIds.Contains(row.Id);
Items.Add(row);