From efac161b128a6421b08f881749f24be0e68626dd Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 20 Nov 2024 16:52:30 +0800 Subject: [PATCH] refactor: update `Repository.HistoriesFilterMode` in `Repository.RefreshHistoriesFilters` Signed-off-by: leo --- src/ViewModels/Repository.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 2a87cb15..ab7924d5 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -704,12 +704,7 @@ namespace SourceGit.ViewModels { var changed = _settings.UpdateHistoriesFilter(tag.Name, Models.FilterType.Tag, mode); if (changed) - { - if (mode != Models.FilterMode.None || _settings.HistoriesFilters.Count == 0) - HistoriesFilterMode = mode; - RefreshHistoriesFilters(); - } } public void SetBranchFilterMode(BranchTreeNode node, Models.FilterMode mode) @@ -754,9 +749,6 @@ namespace SourceGit.ViewModels cur = parent; } while (true); - if (mode != Models.FilterMode.None || _settings.HistoriesFilters.Count == 0) - HistoriesFilterMode = mode; - RefreshHistoriesFilters(); } @@ -2073,6 +2065,12 @@ namespace SourceGit.ViewModels UpdateBranchTreeFilterMode(LocalBranchTrees, filters); UpdateBranchTreeFilterMode(RemoteBranchTrees, filters); UpdateTagFilterMode(filters); + + if (_settings.HistoriesFilters.Count > 0) + HistoriesFilterMode = _settings.HistoriesFilters[0].Mode; + else + HistoriesFilterMode = Models.FilterMode.None; + Task.Run(RefreshCommits); }