fix: bag freezing screen on initial open

This commit is contained in:
Vati
2026-04-16 14:00:41 +04:00
parent 9f3a6275ac
commit f1618b71bd
6 changed files with 140 additions and 23 deletions
+9 -6
View File
@@ -102,25 +102,28 @@ local function CancelDeferredUsabilityCheck()
end
end
-- Update usability tints on all visible item buttons
local function UpdateAllUsabilityTints()
-- Update usability tints on all visible item buttons — cache-only.
-- Every SetBagItem tooltip scan on a cold item can block 50-500ms, so we
-- never trigger scans from the bag-open path. Tints appear for items
-- already cached; uncached items stay untinted until CacheWarmer fills
-- them in (its BagFrame hook triggers a re-sweep when done).
function Guda_BagFrame_UpdateAllUsabilityTints()
if not Guda_BagFrame or not Guda_BagFrame:IsShown() then return end
-- Don't scan ~80 tooltips synchronously while the user is dragging the
-- frame — it can stall the engine for multiple seconds on cold caches.
-- The caller will reschedule after the drag ends.
if isFrameMoving then return end
for _, bagParent in pairs(bagParents) do
if bagParent and bagParent.itemButtons then
for button in pairs(bagParent.itemButtons) do
if button.hasItem and button:IsShown() and Guda_ItemButton_UpdateUsableTint then
Guda_ItemButton_UpdateUsableTint(button)
Guda_ItemButton_UpdateUsableTint(button, true) -- cacheOnly
end
end
end
end
end
local UpdateAllUsabilityTints = Guda_BagFrame_UpdateAllUsabilityTints
-- Schedule a deferred usability check with debouncing
local function ScheduleDeferredUsabilityCheck()
-- Create frame on first use