fix(items): also handle first-render-under-lag empty slots
Previous grace-window fix only kicked in when self.hasItem was already set, so first-render-under-lag (login/reloadui while bag data is in flight) still drew empty. Arm a single re-verify on any nil read so a late-arriving item gets redrawn; the verifyArmed flag prevents re-scheduling on genuinely empty slots — it only clears when we see a valid link.
This commit is contained in:
+19
-10
@@ -286,17 +286,26 @@ function ItemSlot:Update()
|
||||
if not self:IsVisible() then return end
|
||||
|
||||
local texture, count, locked, quality, readable, lootable, link = self:GetItemSlotInfo()
|
||||
local now = GetTime()
|
||||
|
||||
-- If the slot was occupied at our last good draw and the live read just
|
||||
-- returned nil within the grace window, keep the previous draw and queue
|
||||
-- a single re-check. No retry storm.
|
||||
if (not link) and self.hasItem and (self.lastGoodTime or 0) + GRACE_WINDOW > GetTime() then
|
||||
scheduleVerify(self)
|
||||
return
|
||||
end
|
||||
|
||||
if link then
|
||||
self.lastGoodTime = GetTime()
|
||||
-- Any nil read might be a lag race (server hasn't delivered item data
|
||||
-- yet). Arm a single re-check so a late arrival redraws correctly. The
|
||||
-- flag stays armed until we see a valid link, so a genuinely empty slot
|
||||
-- doesn't keep re-scheduling.
|
||||
if not link then
|
||||
if not self.verifyArmed then
|
||||
self.verifyArmed = true
|
||||
scheduleVerify(self)
|
||||
end
|
||||
-- If we had a confirmed item recently, also suppress the empty draw
|
||||
-- so the slot doesn't flash. After the grace window we let the empty
|
||||
-- through (genuine moves still resolve at ~0.5s).
|
||||
if self.hasItem and (self.lastGoodTime or 0) + GRACE_WINDOW > now then
|
||||
return
|
||||
end
|
||||
else
|
||||
self.lastGoodTime = now
|
||||
self.verifyArmed = nil
|
||||
end
|
||||
|
||||
self:SetItem(link)
|
||||
|
||||
Reference in New Issue
Block a user