mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
Merge pull request #246 from simoleo89/fix/marketplace-bugs
fix(marketplace): creditsWaiting reset & re-priced offer vanish
This commit is contained in:
+4
@@ -67,6 +67,10 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
|
||||
return prevValue.filter(value => (idsToDelete.indexOf(value.offerId) === -1));
|
||||
});
|
||||
|
||||
// Without this the redeem panel stays visible (creditsWaiting > 0) after
|
||||
// the sold offers are optimistically removed, showing "get 0 sold items".
|
||||
setCreditsWaiting(0);
|
||||
|
||||
SendMessageComposer(new RedeemMarketplaceOfferCreditsMessageComposer());
|
||||
|
||||
setTimeout(() => isRedeemingRef.current = false, 3000);
|
||||
|
||||
+6
-1
@@ -115,13 +115,18 @@ export const CatalogLayoutMarketplacePublicItemsView: FC<CatalogLayoutMarketplac
|
||||
const item = newVal.get(parser.requestedOfferId);
|
||||
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.price = parser.newPrice;
|
||||
item.offerCount--;
|
||||
newVal.set(item.offerId, item);
|
||||
}
|
||||
|
||||
newVal.delete(parser.requestedOfferId);
|
||||
return newVal;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user