diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 652ba805..fe02ce23 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -34,8 +34,19 @@ namespace SourceGit.ViewModels get => _commits; set { + var oldAutoSelectedCommitSHA = AutoSelectedCommit?.SHA; if (SetProperty(ref _commits, value)) { + Models.Commit newSelectedCommit = null; + if (value.Count > 0 && oldAutoSelectedCommitSHA != null) + { + newSelectedCommit = value.Find(x => x.SHA == oldAutoSelectedCommitSHA); + } + if (newSelectedCommit != AutoSelectedCommit) + { + AutoSelectedCommit = newSelectedCommit; + } + Graph = null; Task.Run(() => {