From 592808792a6a49d00233566dd83892a348622559 Mon Sep 17 00:00:00 2001 From: Florian Berthold Date: Thu, 14 May 2026 06:20:03 +0200 Subject: [PATCH] Revert "fix(items): defer empty draw when slot reads nil after lag" This reverts commit 1af22578d7b7cdaa758827338bcc38a28df4d712. --- Bagnon/utility/itemEvents.lua | 38 +++-------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/Bagnon/utility/itemEvents.lua b/Bagnon/utility/itemEvents.lua index acc1843..6ba4e41 100644 --- a/Bagnon/utility/itemEvents.lua +++ b/Bagnon/utility/itemEvents.lua @@ -45,7 +45,6 @@ Bagnon.BagEvents = BagEvents local slots = {} local bagTypes = {} -local pendingBags = {} local function ToIndex(bag, slot) return (bag < 0 and bag*100 - slot) or bag*100 + slot @@ -55,29 +54,6 @@ local function GetBagSize(bag) return (bag == KEYRING_CONTAINER and GetKeyRingSize()) or GetContainerNumSlots(bag) end --- Defers a re-check of a bag by ~0.25s; used when a previously occupied slot --- reads back nil (lag race between BAG_UPDATE and item data arriving). -local retryFrame = CreateFrame('Frame') -retryFrame.elapsed = 0 -retryFrame:Hide() -retryFrame:SetScript('OnUpdate', function(self, elapsed) - self.elapsed = self.elapsed + elapsed - if self.elapsed < 0.25 then return end - self.elapsed = 0 - self:Hide() - local bags = pendingBags - pendingBags = {} - for bag in pairs(bags) do - Bagnon.BagEvents:UpdateItems(bag, true) - end -end) - -local function scheduleRetry(bag) - pendingBags[bag] = true - retryFrame.elapsed = 0 - retryFrame:Show() -end - --[[ Startup ]]-- @@ -134,7 +110,7 @@ function BagEvents:RemoveItem(bag, slot) end end -function BagEvents:UpdateItem(bag, slot, isRetry) +function BagEvents:UpdateItem(bag, slot) local data = slots[ToIndex(bag, slot)] if data then @@ -145,14 +121,6 @@ function BagEvents:UpdateItem(bag, slot, isRetry) local start, duration, enable = GetContainerItemCooldown(bag, slot) local onCooldown = (start > 0 and duration > 0 and enable > 0) - -- A previously occupied slot reading back nil is usually a lag race between - -- BAG_UPDATE and item data arriving from the server. Defer once before drawing - -- the slot as empty; on the second pass we trust whatever we read. - if prevLink and (not link) and (not isRetry) then - scheduleRetry(bag) - return - end - if not(prevLink == link and prevCount == count) then data[1] = link data[2] = count @@ -164,9 +132,9 @@ function BagEvents:UpdateItem(bag, slot, isRetry) end end -function BagEvents:UpdateItems(bag, isRetry) +function BagEvents:UpdateItems(bag) for slot = 1, GetBagSize(bag) do - self:UpdateItem(bag, slot, isRetry) + self:UpdateItem(bag, slot) end end