Recover DragonflightUI Extras before GUI build

This commit is contained in:
Dusk-92
2026-08-31 13:37:13 +02:00
parent 8e862972e6
commit 492fc69c0b
+15 -5
View File
@@ -202,8 +202,9 @@ end
-- shaguExtras/shaguExtrasData unset even though addon2 becomes true moments -- shaguExtras/shaguExtrasData unset even though addon2 becomes true moments
-- later. Recover that state from WoW's authoritative addon-loaded flag before -- later. Recover that state from WoW's authoritative addon-loaded flag before
-- DragonflightUI builds the settings page. -- DragonflightUI builds the settings page.
function Compat:RecoverExtrasMetadata() function Compat:RecoverExtrasMetadata(forceLoaded)
if not DFRL or not DFRL.gui or not ExtrasLoaded() then return false end if not DFRL or not DFRL.gui then return false end
if not forceLoaded and not ExtrasLoaded() then return false end
DFRL.addon2 = true DFRL.addon2 = true
@@ -276,12 +277,15 @@ function Compat:InjectAll()
self:GrowDragonflightPanel() self:GrowDragonflightPanel()
end end
function Compat:InstallDragonflightHooks() function Compat:InstallDragonflightHooks(forceExtrasLoaded)
if not DFRL or not DFRL.gui then return end if not DFRL or not DFRL.gui then return end
self.active = true self.active = true
-- Repair DragonflightUI's Extras metadata race before any injection attempt. -- Repair DragonflightUI's Extras metadata race before any injection attempt.
self:RecoverExtrasMetadata() -- During ADDON_LOADED itself, Vanilla can still report IsAddOnLoaded() as
-- false until the event finishes, so trust the event when explicitly told
-- that ShaguTweaks-extras has just completed loading.
self:RecoverExtrasMetadata(forceExtrasLoaded)
-- DragonflightUI builds the ShaguTweaks page from its config-ready callback. -- DragonflightUI builds the ShaguTweaks page from its config-ready callback.
-- Insert our metadata immediately before that page is drawn. -- Insert our metadata immediately before that page is drawn.
@@ -327,7 +331,13 @@ watcher.retries = 0
watcher:SetScript("OnEvent", function() watcher:SetScript("OnEvent", function()
if event == "ADDON_LOADED" then if event == "ADDON_LOADED" then
if arg1 == "DragonflightUI-Reforged" or arg1 == "ShaguTweaks-extras" then if arg1 == "ShaguTweaks-extras" then
-- All Extras files have finished loading at this point, but
-- IsAddOnLoaded("ShaguTweaks-extras") may not flip to true until after
-- this event returns. Force the recovery now, before VARIABLES_LOADED
-- lets DragonflightUI build its ShaguTweaks page.
Compat:InstallDragonflightHooks(true)
elseif arg1 == "DragonflightUI-Reforged" then
Compat:InstallDragonflightHooks() Compat:InstallDragonflightHooks()
end end
elseif event == "VARIABLES_LOADED" then elseif event == "VARIABLES_LOADED" then