fix(ui): notify IsTasksEmptyRepoHintVisible on every list switch
IsTasksEmptyRepoHintVisible reads _currentList?.Kind directly, but Kind isn't itself observed — the NotifyPropertyChangedFor chain only fires when IsLetClaudeVisible's value actually changes. Switching from a Smart list to an empty User list without a WorkingDir changes Kind while IsLetClaudeVisible (and Has*) stay false in both, so the hint never notified and stayed stale.
This commit is contained in:
@@ -109,4 +109,31 @@ public class TasksIslandEmptyStateTests : IDisposable
|
||||
Assert.False(vm.IsTasksEmptyHintVisible);
|
||||
Assert.False(vm.IsTasksEmptyRepoHintVisible);
|
||||
}
|
||||
|
||||
// Regression: switching from an empty Smart list (never eligible for the repo hint) to an
|
||||
// empty User list without a WorkingDir changes the correct value of
|
||||
// IsTasksEmptyRepoHintVisible from false to true, but IsLetClaudeVisible stays false in both
|
||||
// cases (Smart lists are never User) and HasOverdue/HasOpen/HasCompleted stay false in both
|
||||
// cases (both lists are empty) — so the [NotifyPropertyChangedFor] chain alone never fires.
|
||||
[Fact]
|
||||
public async Task IsTasksEmptyRepoHintVisible_notifies_on_switch_from_smart_list_to_empty_user_list_without_working_dir()
|
||||
{
|
||||
await using var db = NewContext();
|
||||
db.Lists.Add(new ListEntity { Id = "L4", Name = "Work", CreatedAt = DateTime.UtcNow });
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
var vm = NewVm();
|
||||
vm.LoadForList(new ListNavItemViewModel { Id = "smart:important", Name = "Important", Kind = ListKind.Smart, WorkingDir = null });
|
||||
await vm.LoadTask!;
|
||||
Assert.False(vm.IsTasksEmptyRepoHintVisible);
|
||||
|
||||
var raisedProperties = new List<string?>();
|
||||
vm.PropertyChanged += (_, e) => raisedProperties.Add(e.PropertyName);
|
||||
|
||||
vm.LoadForList(new ListNavItemViewModel { Id = "user:L4", Name = "Work", Kind = ListKind.User, WorkingDir = null });
|
||||
await vm.LoadTask!;
|
||||
|
||||
Assert.Contains(nameof(TasksIslandViewModel.IsTasksEmptyRepoHintVisible), raisedProperties);
|
||||
Assert.True(vm.IsTasksEmptyRepoHintVisible);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user