Skip to content

Commit

Permalink
Added loop for item loads.
Browse files Browse the repository at this point in the history
Fixed bank prematurely showing before all item information is available.
  • Loading branch information
Cidan committed Mar 19, 2024
1 parent 04ed21c commit a077745
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions data/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ function items:OnEnable()
return
end
addon.atBank = true
self:RefreshBank()
end)
events:RegisterEvent('BANKFRAME_CLOSED', function()
addon.atBank = false
Expand Down Expand Up @@ -208,7 +207,7 @@ end
---@private
function items:DoRefreshAll()
if not addon.Bags.Bank or not addon.Bags.Backpack then return end
if addon.Bags.Bank.frame:IsShown() then
if addon.Bags.Bank.frame:IsShown() or addon.atBank then
if addon.Bags.Bank.isReagentBank then
self:RefreshReagentBank()
else
Expand Down Expand Up @@ -475,7 +474,10 @@ end
-- Load item data in the background, and fire a message when
-- all bags are done loading.
function items:ProcessContainer()
self._container:ContinueOnLoad(function() self:BackpackLoadFunction() end)
local loaded = false
repeat
loaded = self._container:ContinueOnLoad(function() self:BackpackLoadFunction() end)
until loaded
end

function items:BankLoadFunction()
Expand Down Expand Up @@ -566,7 +568,10 @@ end
-- Load item data in the background, and fire a message when
-- all bags are done loading.
function items:ProcessBankContainer()
self._bankContainer:ContinueOnLoad(function() self:BankLoadFunction() end)
local loaded = false
repeat
loaded = self._bankContainer:ContinueOnLoad(function() self:BankLoadFunction() end)
until loaded
end

--TODO(lobato): Completely eliminate the use of ItemMixin.
Expand Down

0 comments on commit a077745

Please sign in to comment.