From 34f3af54c06fbe45eb00b98a0e2091c8e885283c Mon Sep 17 00:00:00 2001 From: Haxxer Date: Sun, 3 Mar 2024 11:41:05 +0000 Subject: [PATCH] Fixed issue with item piles not updating the amount of visible currency when taking 1 unit of currency at a time --- changelog.md | 1 + src/stores/pile-item.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 927dd115..1d022cae 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ - Fixed vault styles not being editable - Fixed merchant activity log events being incorrectly displayed - Fixed custom categories not being applied on items when populating merchants +- Fixed issue with item piles not updating the amount of visible currency when taking 1 unit of currency at a time ## Version 2.8.20 diff --git a/src/stores/pile-item.js b/src/stores/pile-item.js index 447a5d27..a872c057 100644 --- a/src/stores/pile-item.js +++ b/src/stores/pile-item.js @@ -260,8 +260,12 @@ export class PileAttribute extends PileBaseItem { this.name.set(this.attribute.name); this.img.set(this.attribute.img); if (hasProperty(data, this.path)) { - this.quantity.set(Number(getProperty(data, this.path) ?? 0)); - this.currentQuantity.set(Math.min(get(this.currentQuantity), get(this.quantityLeft), get(this.quantity))); + const newQuantity = Number(getProperty(data, this.path) ?? 0); + this.quantity.set(newQuantity); + this.currentQuantity.set(Math.min(get(this.currentQuantity), get(this.quantityLeft), newQuantity)); + if (!this.toShare) { + this.quantityLeft.set(newQuantity); + } this.store.refreshItems(); } });