Cheaper window open, lock-only button refresh, re-sort only changed groups

- UiFrame_OnShow requests a full categorization pass only if the last one
  was more than 60 seconds ago.
- Lock-only cache updates refresh just the affected item buttons
  (AssignItemToItemButton) instead of running UpdateWindow().
- SortGroups() reuses a group's previous sorted order when none of its
  items were re-categorized and it holds exactly the same items; any
  full categorization pass invalidates all sorted orders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W3rwt5PZSpEDkXYzRuRhH
This commit is contained in:
2026-11-02 00:00:41 +00:00
co-authored by Claude Opus 5.5
parent aa9cdef81e
commit b85eb2ce53
4 changed files with 134 additions and 2 deletions
+7
View File
@@ -77,6 +77,10 @@ Bagshui:AddComponent(function()
local shadowId, prevShadowId
-- Reset tracking tables.
if not self.lockOnlyChangedItems then
self.lockOnlyChangedItems = {}
end
BsUtil.TableClear(self.lockOnlyChangedItems)
BsUtil.TableClear(self.partialStacks)
BsUtil.TableClear(self.emptyGenericContainerSlots)
@@ -267,6 +271,7 @@ bagInfo.numSlots > 0 and (not bagInfo.name or not bagInfo.type)
and not self.forceFullCacheUpdate
then
item.locked = nowLocked
self.lockOnlyChangedItems[item] = true
-- Process item if there are changes.
elseif
preItemLink ~= nowItemLink -- Item has changed.
@@ -555,6 +560,8 @@ item._proposedStockState ~= BS_ITEM_STOCK_STATE.DOWN
self.cacheChanged = (majorChanges or cosmeticChanges or minorChanges)
-- Lock-only (cosmetic) changes redraw the window but don't need every item re-categorized.
self.cacheNeedsCategorize = (majorChanges or minorChanges or itemChanges)
-- Nothing but items locking/unlocking: Update() can refresh just those buttons.
self.cacheOnlyLockChanges = (cosmeticChanges and not self.cacheNeedsCategorize) and true or false
-- Make sure we don't do a full cache rebuild again.
self.initialInventoryUpdateNeeded = false