From 8902d43f4081182d3b05553dc6eb5bab5778aca3 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:48:53 -0500 Subject: [PATCH] nameplates: wipe full plate.cache on reassignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The plate-reuse reset only cleared name/guid/player/cdCache, leaving hp/hpmax/rgb/namecolor/levelcolor/target/mouseover/inCombat behind. The PERF gates downstream ("only update X when X changed") then skipped bar fill / color / text updates when the new occupant happened to share a cached value with the previous one — most easily reproduced on plate-pool reuse in starting zones (mobs churn fast, percentage values collide). Nuke the whole cache via table.wipe. Refs #8. --- modules/nameplates.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index a6b76ca2..3da9d071 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -937,10 +937,15 @@ end -- 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.cache.player = nil plate.cdCache = nil -- new unit, reset spell-keyed timer cache plate.name:SetText(GetNameString(name)) end