From 8572f648704a963224403c43d55c9073642a9aa3 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Sun, 24 Jul 2022 22:13:31 -0700 Subject: [PATCH] Don't look up unfilled bets for every sell button --- web/components/bets-list.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index c5decd55..25cd00ad 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -657,7 +657,13 @@ function BetRow(props: { !isClosed && !isSold && !isAnte && - !isNumeric && } + !isNumeric && ( + + )} {isCPMM && {shares >= 0 ? 'BUY' : 'SELL'}} @@ -697,8 +703,12 @@ function BetRow(props: { ) } -function SellButton(props: { contract: Contract; bet: Bet }) { - const { contract, bet } = props +function SellButton(props: { + contract: Contract + bet: Bet + unfilledBets: LimitBet[] +}) { + const { contract, bet, unfilledBets } = props const { outcome, shares, loanAmount } = bet const [isSubmitting, setIsSubmitting] = useState(false) @@ -708,8 +718,6 @@ function SellButton(props: { contract: Contract; bet: Bet }) { outcome === 'NO' ? 'YES' : outcome ) - const unfilledBets = useUnfilledBets(contract.id) ?? [] - const outcomeProb = getProbabilityAfterSale( contract, outcome,