fix(ui): stop the reconcile tick on native close, index rows in the tick
Two follow-ups to the Phase 3 reconcile tick: - LogVisualizer and WorktreesOverview only stopped their timer in the Close command, but ShowLogVisualizerAsync/ShowWorktreesOverviewAsync had no dlg.Closed fallback (unlike the MergeHelper picker). An Alt+F4 or owner close left a 4s timer polling the worker / re-running LoadAsync on an orphaned VM, accumulating one per open. Extracted StopReconcileTick on both VMs and wired it from Closed. - The tick scanned Items linearly per id; at the 500-row cap that is ~250k string comparisons every few seconds. Index the rows once instead.
This commit is contained in:
@@ -75,10 +75,18 @@ public sealed partial class LogVisualizerViewModel : ViewModelBase
|
||||
|
||||
[RelayCommand]
|
||||
private void Close()
|
||||
{
|
||||
StopReconcileTick();
|
||||
CloseAction?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>Stops the reconcile tick. Also called from the dialog's native-close fallback
|
||||
/// (WindowDialogService), which bypasses <see cref="CloseCommand"/> — otherwise an Alt+F4
|
||||
/// leaves the timer polling the worker on an orphaned VM. Idempotent.</summary>
|
||||
internal void StopReconcileTick()
|
||||
{
|
||||
_reconcileTimer.Stop();
|
||||
_reconcileTimer.Dispose();
|
||||
CloseAction?.Invoke();
|
||||
}
|
||||
|
||||
private bool CanCopyLast() => Rows.Count > 0;
|
||||
|
||||
@@ -192,10 +192,18 @@ public sealed partial class WorktreesOverviewModalViewModel : ViewModelBase
|
||||
|
||||
[RelayCommand]
|
||||
private void Close()
|
||||
{
|
||||
StopReconcileTick();
|
||||
CloseAction?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>Stops the reconcile tick. Also called from the dialog's native-close fallback
|
||||
/// (WindowDialogService), which bypasses <see cref="CloseCommand"/> — otherwise an Alt+F4
|
||||
/// leaves the timer re-running LoadAsync (git + DB) on an orphaned VM. Idempotent.</summary>
|
||||
internal void StopReconcileTick()
|
||||
{
|
||||
_reconcileTimer.Stop();
|
||||
_reconcileTimer.Dispose();
|
||||
CloseAction?.Invoke();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
||||
Reference in New Issue
Block a user