Skip to content

Commit a7b564d

Browse files
authored
Merge pull request #2015 from LarryThiessen/fix-2010-spellcache-load
#2010 Draw the Spell Cache editor on first open, not at addon load
2 parents c61f9b4 + b17d7a7 commit a7b564d

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

GSE_GUI/SpellCache.lua

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,22 @@ tabgrp:SetCallback(
229229
tabgrp:SetFullWidth(true)
230230
tabgrp:SetFullHeight(true)
231231

232-
if cacheTabs[1] then
233-
tabgrp:SelectTab(cacheTabs[1].value)
234-
end
232+
-- Draw the tab's contents when the window is first SHOWN, not while the addon
233+
-- loads. SelectTab fires GUISelectCacheTab -> GUIDrawSpellCacheEditor, which
234+
-- builds two EditBoxes plus labels for EVERY cached spell. This frame starts
235+
-- hidden and most authors never open it, so doing that during the on-demand
236+
-- LoadAddOn (which is what opening the GSE menu triggers) stalled the client
237+
-- for seconds on a cache built up over years.
238+
local pendingInitialTab = cacheTabs[1] and cacheTabs[1].value
239+
cacheFrame.frame:HookScript(
240+
"OnShow",
241+
function()
242+
if not pendingInitialTab then return end
243+
local tab = pendingInitialTab
244+
pendingInitialTab = nil
245+
tabgrp:SelectTab(tab)
246+
end
247+
)
235248
cacheFrame:AddChild(tabgrp)
236249

237250
if cacheFrame and cacheFrame.frame and GSE.RegisterUIScaleFrame then

0 commit comments

Comments
 (0)