From 650bcda0014c1c45d0bde876d9c0504aebe1d17c Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Fri, 17 Jul 2026 15:55:54 -0500 Subject: [PATCH] Allocate newitem glow lazily, only for slots that go new UpdateSlot previously created the glow texture and OnEnter acknowledge hook on the first pass over every slot, then toggled visibility. Move both inside the "is new" branch so a slot only allocates when it actually holds a new item -- most bag/bank slots never do. Behavior is unchanged: the glow is still created once per slot and reused, and the hook is installed exactly when it's first needed. --- modules/newitem.lua | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/modules/newitem.lua b/modules/newitem.lua index 6a29134f..fe61277c 100644 --- a/modules/newitem.lua +++ b/modules/newitem.lua @@ -13,24 +13,29 @@ pfUI:RegisterModule("newitem", function () local frame = pfUI.bags[bag].slots[slot].frame - if not frame.newitem then - local glow = frame:CreateTexture(nil, "OVERLAY") - glow:SetTexture("Interface\\Buttons\\UI-ActionButton-Border") - glow:SetBlendMode("ADD") - glow:SetVertexColor(color:GetRGBA()) - glow:SetPoint("CENTER", frame, "CENTER") - glow:Hide() - frame.newitem = glow + if frame.hasItem and C_NewItems.IsNewItem(bag, slot) then + if not frame.newitem then + local glow = frame:CreateTexture(nil, "OVERLAY") + glow:SetTexture("Interface\\Buttons\\UI-ActionButton-Border") + glow:SetBlendMode("ADD") + glow:SetVertexColor(color:GetRGBA()) + glow:SetPoint("CENTER", frame, "CENTER") + glow:Hide() + glow.RefreshSize = function(g) + local w = g:GetParent():GetWidth() + if w > 0 then g:SetSize(w * 1.8, w * 1.8) end + end + frame.newitem = glow - frame:HookScript("OnEnter", function() - C_NewItems.RemoveNewItem(bag, slot) - end) + frame:HookScript("OnEnter", function() + C_NewItems.RemoveNewItem(bag, slot) + end) + end + frame.newitem:RefreshSize() + frame.newitem:Show() + elseif frame.newitem and frame.newitem:IsShown() then + frame.newitem:Hide() end - - local w = frame:GetWidth() - if w > 0 then frame.newitem:SetSize(w * 1.8, w * 1.8) end - - frame.newitem:SetShown(frame.hasItem and C_NewItems.IsNewItem(bag, slot)) end -- The new-item set can change without any slot's contents changing (an item