Skip to content

Commit 2c17627

Browse files
committed
fix(order-ticket): drop catalog-price fallback when orderbook will load
The sell-side proceeds preview flickered: catalog market.price (often stale or off by an order of magnitude on thin venues like Limitless) rendered instantly, then ~100ms later the live bid landed and the proceeds jumped. Use the live book only when a tokenId is present; fall back to market.price only for UUID-only picks where no book fetch is possible. Bumps widgets to 0.5.9.
1 parent fe88840 commit 2c17627

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

packages/widgets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pmxt-widgets",
3-
"version": "0.5.8",
3+
"version": "0.5.9",
44
"description": "Copy-paste React widgets for building on PMXT \u2014 prediction market search, orderbooks, charts, and a full non-custodial buy/sell flow.",
55
"license": "MIT",
66
"type": "module",

packages/widgets/src/widgets/order-ticket.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,13 @@ export function OrderTicket({
130130
const book = useOrderBook(market.venue, market.tokenId || null, { depth: 5 });
131131
const bestAsk = book.data?.asks?.[0]?.price;
132132
const bestBid = book.data?.bids?.[0]?.price;
133-
const fallbackPrice = market.price > 0 ? market.price : null;
133+
// Live-only when an orderbook is being fetched. The catalog price is
134+
// often stale (or off by an order of magnitude on thin venues like
135+
// Limitless), and showing it first then swapping to the live bid/ask
136+
// a beat later looks like a value flicker. Fall back to market.price
137+
// ONLY when there's no orderbook to fetch at all (UUID-only picks).
138+
const hasBook = market.tokenId != null && market.tokenId !== '';
139+
const fallbackPrice = !hasBook && market.price > 0 ? market.price : null;
134140
const referencePrice = isBuy
135141
? (bestAsk ?? fallbackPrice)
136142
: (bestBid ?? fallbackPrice);

0 commit comments

Comments
 (0)