Skip to content

Commit b17d7a7

Browse files
LarryThiessenclaude
andcommitted
#2010 Draw the Spell Cache editor on first open, not at addon load
SpellCache.lua's setup ended with SelectTab on the first cache tab, which fires GUIDrawSpellCacheEditor and builds two EditBoxes plus labels for EVERY cached spell -- at load time, for a frame that starts hidden. The cache only grows (imports merge the exporter's whole cache, the translator caches every name it resolves, nothing prunes), so long-time users paid seconds of frozen client inside the on-demand LoadAddOn("GSE_GUI") that opening any first GSE window triggers. Measured: 3.8s of a 4.4s blocked frame. Defer the initial tab draw to the frame's first OnShow: the window pays its own cost when actually opened, and loading the GUI stops stalling the client. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d5dfe3d commit b17d7a7

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)