From 0cbd9ecf984b98e5494243ff78edd1f66c60c9d0 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 27 Jun 2026 16:01:24 -0500 Subject: [PATCH] Revert "nameplates: drop redundant name check from plate-reassignment gate" This reverts commit 6ca482fcaa38dfd1869d10ccbfe1ad0f1e06e277. --- modules/nameplates.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index ada7e6af..3da9d071 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -933,15 +933,18 @@ 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 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 + -- 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 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))