Skip unnecessary MaterialStorageControl updates (#32662)

Remove unnecessary dictionary copying
This commit is contained in:
Ben Bryant
2025-04-17 12:41:15 +02:00
committed by GitHub
parent 0ad56dfddd
commit 73e3e90198

View File

@@ -3,6 +3,7 @@ using Content.Shared.Materials;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Client.Materials.UI;
@@ -17,7 +18,7 @@ public sealed partial class MaterialStorageControl : ScrollContainer
private EntityUid? _owner;
private Dictionary<string, int> _currentMaterials = new();
private Dictionary<ProtoId<MaterialPrototype>, int> _currentMaterials = new();
public MaterialStorageControl()
{
@@ -44,7 +45,7 @@ public sealed partial class MaterialStorageControl : ScrollContainer
}
var canEject = materialStorage.CanEjectStoredMaterials;
var mats = materialStorage.Storage.Select(pair => (pair.Key.Id, pair.Value)).ToDictionary();
var mats = materialStorage.Storage;
if (_currentMaterials.Equals(mats))
return;