Skip to content

Charged items: revert greyed-on-cooldown override, keep RequestLayout fix - #112

Merged
argium merged 5 commits into
mainfrom
copilot/fix-health-stones-cd-update
Jul 10, 2026
Merged

Charged items: revert greyed-on-cooldown override, keep RequestLayout fix#112
argium merged 5 commits into
mainfrom
copilot/fix-health-stones-cd-update

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

#111

The previous fix overcorrected: it kept consumed items (count=0) on bars as greyed icons while a cooldown was active. For use-charge items like Healthstones, the item stays in the bag (count stays >0) until all charges are spent — so the "show greyed when consumed" path was never the right fix. When the last charge is used and the item is consumed, the icon should disappear like any other item.

The actual fix is RequestLayout in OnBagUpdateCooldown: when a non-last charge is used, BAG_UPDATE_DELAYED doesn't fire (bag contents unchanged), so only BAG_UPDATE_COOLDOWN fires. The RequestLayout call ensures layout re-evaluates and the icon stays visible with the updated cooldown.

Changes

  • resolveFirstItem: Revert to showIfMissing gate only. Consumed items (count=0) are always hidden unless showIfMissing is explicitly configured.
-- Before (overcorrected): active cooldown bypassed showIfMissing gate
elseif not missingData then
    local _, duration = C_Item.GetItemCooldown(itemId)
    if showIfMissing or (duration and duration > 0) then ...

-- After: only showIfMissing controls visibility of absent items
elseif showIfMissing and not missingData then
    ...
  • OnBagUpdateCooldown: Unchanged — RequestLayout call is retained as the correct mechanism for refreshing charge-based item icons.
  • Tests: Replace "shows consumed icon greyed with cooldown" (wrong behaviour) with a parameterised test covering both cooldown states, asserting consumed items are hidden in both cases.

Copilot AI linked an issue Jul 9, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Test Results

948 tests  +3   948 ✅ +3   1s ⏱️ -1s
  4 suites ±0     0 💤 ±0 
  4 files   ±0     0 ❌ ±0 

Results for commit 1b2d531. ± Comparison against base commit b4b4724.

This pull request removes 41 and adds 44 tests. Note that renamed tests count towards both.
Tests/Modules.ExtraIcons_spec_lua:1008 ‑ ExtraIcons real source continues conservatively when GetItemFrames iteration fails
Tests/Modules.ExtraIcons_spec_lua:1047 ‑ ExtraIcons real source matches the utility viewer's square overlay footprint
Tests/Modules.ExtraIcons_spec_lua:1072 ‑ ExtraIcons real source skips disabled entries during layout resolution
Tests/Modules.ExtraIcons_spec_lua:1100 ‑ ExtraIcons real source publishes a combined main-viewer anchor when main extra icons are shown
Tests/Modules.ExtraIcons_spec_lua:1134 ‑ ExtraIcons real source restores the utility viewer when an icon moves to main
Tests/Modules.ExtraIcons_spec_lua:1193 ‑ ExtraIcons real source prefers demonic healthstone over the legacy healthstone
Tests/Modules.ExtraIcons_spec_lua:1215 ‑ ExtraIcons real source completely ignores items in the ignored item list
Tests/Modules.ExtraIcons_spec_lua:1243 ‑ ExtraIcons real source resolves item stack entries through their priority list
Tests/Modules.ExtraIcons_spec_lua:1275 ‑ ExtraIcons real source prefers owned item stack entries over the missing fallback
Tests/Modules.ExtraIcons_spec_lua:1310 ‑ ExtraIcons real source shows missing item stack entries as greyscale when configured
…
Tests/Modules.ExtraIcons_spec_lua:1019 ‑ ExtraIcons real source continues conservatively when GetItemFrames iteration fails
Tests/Modules.ExtraIcons_spec_lua:1058 ‑ ExtraIcons real source matches the utility viewer's square overlay footprint
Tests/Modules.ExtraIcons_spec_lua:1083 ‑ ExtraIcons real source skips disabled entries during layout resolution
Tests/Modules.ExtraIcons_spec_lua:1111 ‑ ExtraIcons real source publishes a combined main-viewer anchor when main extra icons are shown
Tests/Modules.ExtraIcons_spec_lua:1145 ‑ ExtraIcons real source restores the utility viewer when an icon moves to main
Tests/Modules.ExtraIcons_spec_lua:1204 ‑ ExtraIcons real source prefers demonic healthstone over the legacy healthstone
Tests/Modules.ExtraIcons_spec_lua:1226 ‑ ExtraIcons real source completely ignores items in the ignored item list
Tests/Modules.ExtraIcons_spec_lua:1254 ‑ ExtraIcons real source resolves item stack entries through their priority list
Tests/Modules.ExtraIcons_spec_lua:1286 ‑ ExtraIcons real source prefers owned item stack entries over the missing fallback
Tests/Modules.ExtraIcons_spec_lua:1321 ‑ ExtraIcons real source shows missing item stack entries as greyscale when configured
…

♻️ This comment has been updated with latest results.

Copilot AI and others added 2 commits July 9, 2026 21:41
Co-authored-by: argium <15852038+argium@users.noreply.github.com>
- resolveFirstItem: show icon as missing (greyed) when item has an
  active cooldown, regardless of showIfMissing setting. Fixes the root
  cause: consumed items (count = 0) now remain visible with their
  cooldown timer, matching UX for potions that have multiple charges.
- OnBagUpdateCooldown: also call RequestLayout so the layout is
  re-evaluated when any item cooldown changes, ensuring icons are
  properly hidden once the cooldown clears and the item is still absent.
- Tests: three new cases covering the new behaviour and the preserved
  hide-when-no-cooldown path.

Co-authored-by: argium <15852038+argium@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix health stones cooldown update while in combat Fix healthstone icon not showing cooldown after use in combat Jul 9, 2026
Copilot AI requested a review from argium July 9, 2026 21:45
Copilot finished work on behalf of argium July 9, 2026 21:45
Copilot AI and others added 2 commits July 9, 2026 22:10
… charge use

- resolveFirstItem: revert to showIfMissing gate only. Consumed items
  (count=0) are hidden regardless of active cooldown. Only showIfMissing
  entries remain visible as greyed icons when absent.
- OnBagUpdateCooldown: keep RequestLayout call. This is the real fix for
  use-charge items (Healthstones with multiple charges): BAG_UPDATE_DELAYED
  does not fire when a charge is consumed but the item stays in the bag, so
  RequestLayout ensures the layout is re-evaluated and the cooldown shown.
- Tests: replace "greyed with cooldown" test (wrong behaviour) with
  "hidden even with active cooldown" test (correct behaviour); rename
  RequestLayout test to accurately reflect its purpose.

Co-authored-by: argium <15852038+argium@users.noreply.github.com>
Co-authored-by: argium <15852038+argium@users.noreply.github.com>
Copilot AI changed the title Fix healthstone icon not showing cooldown after use in combat Charged items: revert greyed-on-cooldown override, keep RequestLayout fix Jul 9, 2026
Copilot finished work on behalf of argium July 9, 2026 22:12
Comment thread Modules/ExtraIcons.lua
Copilot AI requested a review from argium July 10, 2026 01:45
@argium
argium marked this pull request as ready for review July 10, 2026 04:21
Copilot AI review requested due to automatic review settings July 10, 2026 04:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes charged-item (e.g., Healthstone) cooldown display updates by ensuring the ExtraIcons bar re-evaluates layout on BAG_UPDATE_COOLDOWN, while restoring the intended behavior that fully-consumed items (count = 0) do not remain visible/greyed unless explicitly configured (showIfMissing).

Changes:

  • Trigger a layout re-evaluation on bag cooldown changes by calling ns.Runtime.RequestLayout in ExtraIcons:OnBagUpdateCooldown.
  • Update/expand specs to (a) assert the new RequestLayout behavior and (b) verify consumed item-stacks are hidden regardless of cooldown state.
  • Update Serena project configuration/documentation comments (no runtime impact).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Modules/ExtraIcons.lua Requests layout on OnBagUpdateCooldown to keep charged items visible while their cooldown updates.
Tests/Modules/ExtraIcons_spec.lua Adds coverage for the new layout request and validates consumed items are hidden with/without cooldown.
.serena/project.yml Updates Serena project config comments/fields for LSP indexing/workspace folders.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@argium
argium merged commit 8e47b2f into main Jul 10, 2026
4 checks passed
@argium
argium deleted the copilot/fix-health-stones-cd-update branch July 10, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Health stones don't show cd update while in combat

3 participants