category view spacing bug fixed

This commit is contained in:
Salikh Gurgenidze
2026-01-24 14:42:16 +04:00
parent 622877df4a
commit 59f9defd13
4 changed files with 73 additions and 1 deletions
+21 -1
View File
@@ -143,10 +143,21 @@ local categoriesCache = nil
local specialItemsCache = nil
-- Clear a table without creating a new one (Lua 5.0 compatible)
-- For arrays, iterate backwards to safely remove all elements
local function WipeTable(t)
if not t then return end
-- For arrays (numeric keys), remove from end to start
local n = table.getn(t)
if n > 0 then
for i = n, 1, -1 do
table.remove(t, i)
end
end
-- Also clear any non-numeric keys (hash part)
for k in pairs(t) do
t[k] = nil
if type(k) ~= "number" then
t[k] = nil
end
end
end
@@ -161,10 +172,19 @@ function Guda_InitCategories()
end
-- Clear existing category arrays (don't recreate the main table)
local totalItemsBeforeWipe = 0
for cat, items in pairs(categoriesCache) do
totalItemsBeforeWipe = totalItemsBeforeWipe + table.getn(items)
WipeTable(items)
end
-- Verify wipe worked
local totalItemsAfterWipe = 0
for cat, items in pairs(categoriesCache) do
totalItemsAfterWipe = totalItemsAfterWipe + table.getn(items)
end
addon:DebugCategory("InitCategories: beforeWipe=%d, afterWipe=%d", totalItemsBeforeWipe, totalItemsAfterWipe)
if addon.Modules.CategoryManager then
-- Get full category order (all categories, not just enabled)
local allCategories = addon.Modules.CategoryManager:GetCategoryOrder()