Dungeon ShopHUD buy clicks never purchase — buyItem is not wired to buyShopItem #1084

Closed
opened 2026-08-13 13:54:15 +00:00 by spikerj · 1 comment
Owner

Summary

ShopHUD.handleClick fires onAction("buyItem", id) when a buy button is hit, but DungeonCrawlerComponent only handles "close":

this.shopHUD.onAction = (action) => {
  if (action === "close") this.showShopModal.set(false);
};

buyShopItem(item) exists and is covered by unit tests, but nothing maps the HUD item id to it. Clicking Buy in the native shop overlay therefore does nothing (gold is not deducted, inventory is not updated).

Also

  • setItems has no equality guard, so updateModalHUDs rebuilds the whole shop every frame while the modal is open (C-7).
  • setItems only slice()s the array — item objects are shared with the caller.
  • Clicks on the shop panel background return false, so HUDScene.handleClick continues to lower panels.

Files

  • projects/spikersoft/src/app/_components/_games/dungeon-crawler/hud/shop-hud.ts
  • projects/spikersoft/src/app/_components/_games/dungeon-crawler/dungeon-crawler.component.ts (~2284, buyShopItem ~9267)
## Summary `ShopHUD.handleClick` fires `onAction("buyItem", id)` when a buy button is hit, but `DungeonCrawlerComponent` only handles `"close"`: ```ts this.shopHUD.onAction = (action) => { if (action === "close") this.showShopModal.set(false); }; ``` `buyShopItem(item)` exists and is covered by unit tests, but nothing maps the HUD item id to it. Clicking Buy in the native shop overlay therefore does nothing (gold is not deducted, inventory is not updated). ## Also - `setItems` has no equality guard, so `updateModalHUDs` rebuilds the whole shop every frame while the modal is open (C-7). - `setItems` only `slice()`s the array — item objects are shared with the caller. - Clicks on the shop panel background return `false`, so `HUDScene.handleClick` continues to lower panels. ## Files - `projects/spikersoft/src/app/_components/_games/dungeon-crawler/hud/shop-hud.ts` - `projects/spikersoft/src/app/_components/_games/dungeon-crawler/dungeon-crawler.component.ts` (~2284, `buyShopItem` ~9267)
Author
Owner

Fixed in spikersoft-angular PR #823 (a0f0ccd9). Closing.

Fixed in `spikersoft-angular` [PR #823](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/823) (`a0f0ccd9`). Closing.
Sign in to join this conversation.