Surprisingly, it's simpler in Dragon Flight.
Lua Code:
-- Doesn't need to be done, but saves some (not all) processing
TargetFrame:UnregisterEvent("UNIT_AURA");
FocusFrame:UnregisterEvent("UNIT_AURA");
local function ReleaseAllAuras(self)
for obj in self.auraPools:EnumerateActive() do obj:Hide(); end
self.auraPools:ReleaseAll()
end
hooksecurefunc(TargetFrame,"UpdateAuras",ReleaseAllAuras);
hooksecurefunc(FocusFrame,"UpdateAuras",ReleaseAllAuras);
Blizzard switched to using Mixins for most of TargetFrame's functions, meaning we can hook the Target and Focus frames directly without other inheriting frames triggering our hook. Secondly, buffs and debuffs are handled by frame pools now, which makes iterating through them easier as well.
Note: There's a bug in EditMode which throws taint errors if any addon touches any managed frame.