mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
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:
+6
-1
@@ -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;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user