@@ -23,11 +23,11 @@ public List<Models.Commit> Commits
2323 get => _commits ;
2424 set
2525 {
26- var lastSelected = AutoSelectedCommit ;
26+ var lastSelected = SelectedCommit ;
2727 if ( SetProperty ( ref _commits , value ) )
2828 {
2929 if ( value . Count > 0 && lastSelected != null )
30- AutoSelectedCommit = value . Find ( x => x . SHA == lastSelected . SHA ) ;
30+ SelectedCommit = value . Find ( x => x . SHA == lastSelected . SHA ) ;
3131 }
3232 }
3333 }
@@ -38,10 +38,10 @@ public Models.CommitGraph Graph
3838 set => SetProperty ( ref _graph , value ) ;
3939 }
4040
41- public Models . Commit AutoSelectedCommit
41+ public Models . Commit SelectedCommit
4242 {
43- get => _autoSelectedCommit ;
44- set => SetProperty ( ref _autoSelectedCommit , value ) ;
43+ get => _selectedCommit ;
44+ set => SetProperty ( ref _selectedCommit , value ) ;
4545 }
4646
4747 public long NavigationId
@@ -97,7 +97,7 @@ public void Dispose()
9797 Commits = [ ] ;
9898 _repo = null ;
9999 _graph = null ;
100- _autoSelectedCommit = null ;
100+ _selectedCommit = null ;
101101 _detailContext ? . Dispose ( ) ;
102102 _detailContext = null ;
103103 }
@@ -138,7 +138,8 @@ public void NavigateTo(string commitSHA)
138138 var commit = _commits . Find ( x => x . SHA . StartsWith ( commitSHA , StringComparison . Ordinal ) ) ;
139139 if ( commit != null )
140140 {
141- NavigateTo ( commit ) ;
141+ SelectedCommit = commit ;
142+ NavigationId = _navigationId + 1 ;
142143 return ;
143144 }
144145
@@ -148,12 +149,32 @@ public void NavigateTo(string commitSHA)
148149 . GetResultAsync ( )
149150 . ConfigureAwait ( false ) ;
150151
151- Dispatcher . UIThread . Post ( ( ) => NavigateTo ( c ) ) ;
152+ Dispatcher . UIThread . Post ( ( ) =>
153+ {
154+ _ignoreSelectionChange = true ;
155+ SelectedCommit = null ;
156+
157+ if ( _detailContext is CommitDetail detail )
158+ {
159+ detail . Commit = c ;
160+ }
161+ else
162+ {
163+ var commitDetail = new CommitDetail ( _repo , _commitDetailSharedData ) ;
164+ commitDetail . Commit = c ;
165+ DetailContext = commitDetail ;
166+ }
167+
168+ _ignoreSelectionChange = false ;
169+ } ) ;
152170 } ) ;
153171 }
154172
155173 public void Select ( IList commits )
156174 {
175+ if ( _ignoreSelectionChange )
176+ return ;
177+
157178 if ( commits . Count == 0 )
158179 {
159180 _repo . SearchCommitContext . Selected = null ;
@@ -165,7 +186,7 @@ public void Select(IList commits)
165186 if ( _repo . SearchCommitContext . Selected == null || _repo . SearchCommitContext . Selected . SHA != commit . SHA )
166187 _repo . SearchCommitContext . Selected = _repo . SearchCommitContext . Results ? . Find ( x => x . SHA == commit . SHA ) ;
167188
168- AutoSelectedCommit = commit ;
189+ SelectedCommit = commit ;
169190 NavigationId = _navigationId + 1 ;
170191
171192 if ( _detailContext is CommitDetail detail )
@@ -395,40 +416,16 @@ public void CompareWithWorktree(Models.Commit commit)
395416 DetailContext = new RevisionCompare ( _repo . FullPath , commit , null ) ;
396417 }
397418
398- private void NavigateTo ( Models . Commit commit )
399- {
400- AutoSelectedCommit = commit ;
401-
402- if ( commit == null )
403- {
404- DetailContext = null ;
405- }
406- else
407- {
408- NavigationId = _navigationId + 1 ;
409-
410- if ( _detailContext is CommitDetail detail )
411- {
412- detail . Commit = commit ;
413- }
414- else
415- {
416- var commitDetail = new CommitDetail ( _repo , _commitDetailSharedData ) ;
417- commitDetail . Commit = commit ;
418- DetailContext = commitDetail ;
419- }
420- }
421- }
422-
423419 private Repository _repo = null ;
424420 private CommitDetailSharedData _commitDetailSharedData = null ;
425421 private bool _isLoading = true ;
426422 private List < Models . Commit > _commits = new List < Models . Commit > ( ) ;
427423 private Models . CommitGraph _graph = null ;
428- private Models . Commit _autoSelectedCommit = null ;
424+ private Models . Commit _selectedCommit = null ;
429425 private Models . Bisect _bisect = null ;
430426 private long _navigationId = 0 ;
431427 private IDisposable _detailContext = null ;
428+ private bool _ignoreSelectionChange = false ;
432429
433430 private GridLength _leftArea = new GridLength ( 1 , GridUnitType . Star ) ;
434431 private GridLength _rightArea = new GridLength ( 1 , GridUnitType . Star ) ;
0 commit comments