From 4debd5ce098392da20e5254b7e099d77ad8cfc93 Mon Sep 17 00:00:00 2001 From: Mika Kuns Date: Wed, 22 Apr 2026 10:36:09 +0200 Subject: [PATCH] fix(ui): disable Merge button after worktree is no longer Active Add WorktreeStateLabel observable property populated from entity.Worktree?.State.ToString() in both BindAsync and RefreshWorktreeAsync. CanMerge now requires WorktreeStateLabel == "Active" so the button disables after a successful merge with removeWorktree:false. Co-Authored-By: Claude Sonnet 4.6 --- .../ViewModels/Islands/DetailsIslandViewModel.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs index 55f8c5f..7277f72 100644 --- a/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs @@ -58,6 +58,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase [ObservableProperty] private string? _model; [ObservableProperty] private string? _worktreePath; [ObservableProperty] private string? _worktreeBaseCommit; + [ObservableProperty] private string? _worktreeStateLabel; [ObservableProperty] private string? _branchLine; [ObservableProperty] private int _turns; [ObservableProperty] private int _tokens; @@ -231,6 +232,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase Notes = ""; Model = null; WorktreePath = null; + WorktreeStateLabel = null; BranchLine = null; AgentStatusLabel = "Idle"; LatestRunSessionId = null; @@ -260,6 +262,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase Notes = entity.Notes ?? ""; Model = entity.Model; WorktreePath = entity.Worktree?.Path; + WorktreeStateLabel = entity.Worktree?.State.ToString(); BranchLine = entity.Worktree is { } w ? $"{w.BranchName} \u2190 main" : null; AgentStatusLabel = entity.Status.ToString(); @@ -292,6 +295,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase WorktreePath = entity.Worktree?.Path; WorktreeBaseCommit = entity.Worktree?.BaseCommit; + WorktreeStateLabel = entity.Worktree?.State.ToString(); BranchLine = entity.Worktree is { } w ? $"{w.BranchName} ← main" : null; AgentStatusLabel = entity.Status.ToString(); if (Task is { } row && entity.Worktree?.DiffStat is { } stat) @@ -343,6 +347,11 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase ApproveMergeCommand.NotifyCanExecuteChanged(); } + partial void OnWorktreeStateLabelChanged(string? value) + { + ApproveMergeCommand.NotifyCanExecuteChanged(); + } + [RelayCommand] private async System.Threading.Tasks.Task SendPromptAsync() { @@ -398,7 +407,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase } private bool CanMerge() => - Task != null && _worker.IsConnected && WorktreePath != null; + Task != null && _worker.IsConnected && WorktreePath != null && WorktreeStateLabel == "Active"; [RelayCommand] private async System.Threading.Tasks.Task StopAsync()