fix(ui): open the merge modal non-modal so a running merge no longer blocks the main window
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
2b7b58be37
commit
3d74e3dac5
@@ -5,6 +5,11 @@ namespace ClaudeDo.Ui.Views.Modals;
|
||||
|
||||
public partial class MergeModalView : Window
|
||||
{
|
||||
/// Open merge windows by task id — the guard against starting the same merge twice.
|
||||
private static readonly Dictionary<string, MergeModalView> OpenWindows = new();
|
||||
|
||||
private readonly TaskCompletionSource _closed = new();
|
||||
|
||||
public MergeModalView()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -17,5 +22,26 @@ public partial class MergeModalView : Window
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// Shows the merge window non-modally so the owner stays usable while the merge (and its verify
|
||||
/// command) runs. Completes when the window closes; a second call for a task whose window is
|
||||
/// already open activates it and waits on that one instead of opening another.
|
||||
public static Task ShowAsync(Window owner, MergeModalViewModel vm)
|
||||
{
|
||||
if (OpenWindows.TryGetValue(vm.TaskId, out var existing))
|
||||
{
|
||||
if (existing.WindowState == WindowState.Minimized)
|
||||
existing.WindowState = WindowState.Normal;
|
||||
existing.Activate();
|
||||
return existing._closed.Task;
|
||||
}
|
||||
var window = new MergeModalView { DataContext = vm };
|
||||
OpenWindows[vm.TaskId] = window;
|
||||
window.Closed += (_, _) =>
|
||||
{
|
||||
OpenWindows.Remove(vm.TaskId);
|
||||
window._closed.TrySetResult();
|
||||
};
|
||||
window.Show(owner);
|
||||
return window._closed.Task;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user