fix(marketplace): re-priced offer vanished when the server kept the same id

The "price raised" (case 3) handler did `set(item.offerId, item)` then an
unconditional `delete(requestedOfferId)`. When the re-priced offer kept the same
id (offerId === requestedOfferId), the set was immediately undone and the offer
disappeared from the list though it was still buyable. Delete the old key first,
then set under the new id.
This commit is contained in:
simoleo89
2026-06-13 16:53:36 +02:00
parent 26d7ccd62b
commit 101c1b901f
@@ -115,13 +115,18 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
const item = newVal.get(parser.requestedOfferId); const item = newVal.get(parser.requestedOfferId);
if(item) if(item)
{ {
// Delete the OLD key first, then set under the (possibly
// unchanged) new id. The old code did set()-then-delete(),
// so when the server returned the same id for the re-priced
// offer the set was immediately undone and the offer vanished.
newVal.delete(parser.requestedOfferId);
item.offerId = parser.offerId; item.offerId = parser.offerId;
item.price = parser.newPrice; item.price = parser.newPrice;
item.offerCount--; item.offerCount--;
newVal.set(item.offerId, item); newVal.set(item.offerId, item);
} }
newVal.delete(parser.requestedOfferId);
return newVal; return newVal;
}); });