From 6ca482fcaa38dfd1869d10ccbfe1ad0f1e06e277 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:59:16 -0500 Subject: [PATCH] nameplates: drop redundant name check from plate-reassignment gate GUID is the unique identity; the name check was leftover from the name-only era and became dead weight once cachedGuid (NAME_PLATE_UNIT_ ADDED) was added alongside it. --- modules/nameplates.lua | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 3da9d071..ada7e6af 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -933,18 +933,15 @@ end local name = plate.original.name:GetText() local level = plate.original.level:IsShown() and plate.original.level:GetObjectType() == "FontString" and tonumber(plate.original.level:GetText()) or "??" - -- reset per-unit cache when the plate is reassigned. Gate on GUID *and* - -- name — name alone misses pool reuse between same-named units (e.g. plate - -- held a player "Ironforge Guard" and is now reassigned to the NPC by the - -- same name), which would leak a stale "PLAYER" hint into GetUnitInfo. - -- Wipe the whole cache table: the PERF gates below ("only update X when - -- X changed") would otherwise skip bar/color/text updates when the new - -- unit happens to share a cached value with the previous occupant - -- (e.g., both at 60% HP percentage on plate pool reuse → bar stays at - -- the old fill until the new mob actually changes HP). - if plate.cache.name ~= name or plate.cache.guid ~= plate.cachedGuid then + -- Reset per-unit cache on plate pool reuse. GUID alone is the identity — + -- a unit can't change its name without changing GUID, and NAME_PLATE_UNIT_ + -- ADDED writes plate.cachedGuid before this fires. Wipe the whole table: + -- the PERF gates below ("only update X when X changed") would otherwise + -- skip bar/color/text updates when the new unit happens to share a + -- cached value with the previous occupant (e.g., both at 60% HP + -- percentage → bar stays at the old fill until the new mob's HP moves). + if plate.cache.guid ~= plate.cachedGuid then table.wipe(plate.cache) - plate.cache.name = name plate.cache.guid = plate.cachedGuid plate.cdCache = nil -- new unit, reset spell-keyed timer cache plate.name:SetText(GetNameString(name))