diff --git a/Dalamud/Interface/Internal/PluginCategoryManager.cs b/Dalamud/Interface/Internal/PluginCategoryManager.cs
index b7a6a6d6c..5cc5135d3 100644
--- a/Dalamud/Interface/Internal/PluginCategoryManager.cs
+++ b/Dalamud/Interface/Internal/PluginCategoryManager.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using CheapLoc;
using Dalamud.Plugin.Internal.Types;
@@ -114,7 +115,8 @@ namespace Dalamud.Interface.Internal
}
///
- /// Gets a value indicating whether category content needs to be rebuild with BuildCategoryContent() function.
+ /// Gets a value indicating whether current group + category selection changed recently.
+ /// Changes in Available group should be followed with , everythine else can use .
///
public bool IsContentDirty => this.isContentDirty;
@@ -136,6 +138,10 @@ namespace Dalamud.Interface.Internal
// rebuild map plugin name -> categoryIds
this.mapPluginCategories.Clear();
+ var groupAvail = Array.Find(this.groupList, x => x.GroupKind == GroupKind.Available);
+ var prevCategoryIds = new List();
+ prevCategoryIds.AddRange(groupAvail.Categories);
+
var categoryList = new List();
var allCategoryIndices = new List();
@@ -174,7 +180,6 @@ namespace Dalamud.Interface.Internal
allCategoryIndices.Sort((idxX, idxY) => this.CategoryList[idxX].Name.CompareTo(this.CategoryList[idxY].Name));
// rebuild all categories in group, leaving first entry = All intact and always on top
- var groupAvail = Array.Find(this.groupList, x => x.GroupKind == GroupKind.Available);
if (groupAvail.Categories.Count > 1)
{
groupAvail.Categories.RemoveRange(1, groupAvail.Categories.Count - 1);
@@ -185,12 +190,17 @@ namespace Dalamud.Interface.Internal
groupAvail.Categories.Add(this.CategoryList[categoryIdx].CategoryId);
}
- this.isContentDirty = true;
+ // compare with prev state and mark as dirty if needed
+ var noCategoryChanges = Enumerable.SequenceEqual(prevCategoryIds, groupAvail.Categories);
+ if (!noCategoryChanges)
+ {
+ this.isContentDirty = true;
+ }
}
///
/// Filters list of available plugins based on currently selected category.
- /// Resets .
+ /// Resets .
///
/// List of available plugins to install.
/// Filtered list of plugins.
@@ -225,10 +235,18 @@ namespace Dalamud.Interface.Internal
}
}
- this.isContentDirty = false;
+ this.ResetContentDirty();
return result;
}
+ ///
+ /// Clears flag, indicating that all cached values about currently selected group + category have been updated.
+ ///
+ public void ResetContentDirty()
+ {
+ this.isContentDirty = false;
+ }
+
///
/// Sets category highlight based on list of plugins. Used for searching.
///
diff --git a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs
index e359bbffe..50f3b52bd 100644
--- a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs
@@ -535,12 +535,7 @@ namespace Dalamud.Interface.Internal.Windows
return;
}
- // reset opened list of collapsibles when switching between categories
- if (this.categoryManager.IsContentDirty)
- {
- this.openPluginCollapsibles.Clear();
- }
-
+ // get list to show and reset category dirty flag
var categoryManifestsList = this.categoryManager.GetCurrentCategoryContent(filteredManifests);
var i = 0;
@@ -726,6 +721,18 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, ImGuiHelpers.ScaledVector2(1, 3));
var groupInfo = this.categoryManager.GroupList[this.categoryManager.CurrentGroupIdx];
+ if (this.categoryManager.IsContentDirty)
+ {
+ // reset opened list of collapsibles when switching between categories
+ this.openPluginCollapsibles.Clear();
+
+ // do NOT reset dirty flag when Available group is selected, it will be handled by DrawAvailablePluginList()
+ if (groupInfo.GroupKind != PluginCategoryManager.GroupKind.Available)
+ {
+ this.categoryManager.ResetContentDirty();
+ }
+ }
+
if (groupInfo.GroupKind == PluginCategoryManager.GroupKind.DevTools)
{
// this one is never sorted and remains in hardcoded order from group ctor