Merge pull request #246 from simoleo89/fix/marketplace-bugs

fix(marketplace): creditsWaiting reset & re-priced offer vanish
This commit is contained in:
DuckieTM
2026-06-15 07:17:20 +02:00
committed by GitHub
2 changed files with 10 additions and 1 deletions
@@ -67,6 +67,10 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC<CatalogLayoutProps> = prop
return prevValue.filter(value => (idsToDelete.indexOf(value.offerId) === -1)); 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()); SendMessageComposer(new RedeemMarketplaceOfferCreditsMessageComposer());
setTimeout(() => isRedeemingRef.current = false, 3000); setTimeout(() => isRedeemingRef.current = false, 3000);
@@ -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;
}); });