From d4569007078a6430cc1a8c1c85ffb39e491c5129 Mon Sep 17 00:00:00 2001 From: Vati Date: Fri, 3 Apr 2026 02:03:54 +0400 Subject: [PATCH] fix: refresh slots on container swap --- UI/BagFrame.lua | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index 7688500..4a5a3a3 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -3070,16 +3070,26 @@ Guda_TryEquipBagOnSlot = function(bagID, invSlot, button) if hasItems and addon.Modules.BagReplacer then addon.Modules.BagReplacer:Execute(bagID, invSlot) - else - if EquipCursorItem then - EquipCursorItem(invSlot) - elseif PutItemInBag then - PutItemInBag(invSlot) - end + return -- BagReplacer handles its own UI updates + end + + -- Empty bag or no bag — standard equip, then delayed refresh + if EquipCursorItem then + EquipCursorItem(invSlot) + elseif PutItemInBag then + PutItemInBag(invSlot) end if button then Guda_BagSlot_Update(button, bagID) end - if BagFrame and BagFrame.Update then BagFrame:Update() end + + -- Delay the UI refresh so the server has time to process the bag equip + -- (GetContainerNumSlots won't reflect the new bag size immediately) + Guda_ScheduleTimer(0.3, function() + if addon.Modules.BagScanner and addon.Modules.BagScanner.InvalidateCache then + addon.Modules.BagScanner:InvalidateCache() + end + if BagFrame and BagFrame.Update then BagFrame:Update() end + end) end -- OnLoad handler for bag slot buttons