Change the sort algorithm to use UnitExist instead of frame:IsShown

When UNIT_PET fires, pet units will exist but the UnitWatch will not yet
have shown the frame.
This commit is contained in:
omicron committed 2026-06-24 00:37:15 +02:00
1 parent 77ae4ddad3
commit 86e5ed78b0
1 file changed
+7 -11
+7 -11
View File
@@ -32,9 +32,10 @@ local function RoleValue(role)
end
local function UnitFrameDefaultCompare(lhs, rhs)
-- visible < invisible
if lhs.secureFrame:IsShown() ~= rhs.secureFrame:IsShown() then
return lhs.secureFrame:IsShown()
-- exists < not exists
local lexists, rexists = UnitExists(lhs.unit), UnitExists(rhs.unit)
if lexists ~= rexists then
return lexists
end
local lunit, runit = lhs.unit, rhs.unit
@@ -69,7 +70,6 @@ function UnitGroup:Init(left, top, width, height)
self.top = top
self.left = left
self.units = {}
self.sortAfterCombat = false
self:RegisterEvents()
end
@@ -104,18 +104,14 @@ function UnitGroup:PLAYER_REGEN_ENABLED()
end
function UnitGroup:OnLeaveCombat()
if self.sortAfterCombat then
self:Sort()
self.sortAfterCombat = false
end
self:Sort()
end
function UnitGroup:OnRosterUpdate()
if InCombatLockdown() then
self.sortAfterCombat = true
else
self:Sort()
return
end
self:Sort()
end
function UnitGroup:AddUnitFrame(unit)