Don't look up unfilled bets for every sell button
This commit is contained in:
parent
abb3400ddb
commit
8572f64870
|
@ -657,7 +657,13 @@ function BetRow(props: {
|
||||||
!isClosed &&
|
!isClosed &&
|
||||||
!isSold &&
|
!isSold &&
|
||||||
!isAnte &&
|
!isAnte &&
|
||||||
!isNumeric && <SellButton contract={contract} bet={bet} />}
|
!isNumeric && (
|
||||||
|
<SellButton
|
||||||
|
contract={contract}
|
||||||
|
bet={bet}
|
||||||
|
unfilledBets={unfilledBets}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
{isCPMM && <td>{shares >= 0 ? 'BUY' : 'SELL'}</td>}
|
{isCPMM && <td>{shares >= 0 ? 'BUY' : 'SELL'}</td>}
|
||||||
<td>
|
<td>
|
||||||
|
@ -697,8 +703,12 @@ function BetRow(props: {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function SellButton(props: { contract: Contract; bet: Bet }) {
|
function SellButton(props: {
|
||||||
const { contract, bet } = props
|
contract: Contract
|
||||||
|
bet: Bet
|
||||||
|
unfilledBets: LimitBet[]
|
||||||
|
}) {
|
||||||
|
const { contract, bet, unfilledBets } = props
|
||||||
const { outcome, shares, loanAmount } = bet
|
const { outcome, shares, loanAmount } = bet
|
||||||
|
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||||
|
@ -708,8 +718,6 @@ function SellButton(props: { contract: Contract; bet: Bet }) {
|
||||||
outcome === 'NO' ? 'YES' : outcome
|
outcome === 'NO' ? 'YES' : outcome
|
||||||
)
|
)
|
||||||
|
|
||||||
const unfilledBets = useUnfilledBets(contract.id) ?? []
|
|
||||||
|
|
||||||
const outcomeProb = getProbabilityAfterSale(
|
const outcomeProb = getProbabilityAfterSale(
|
||||||
contract,
|
contract,
|
||||||
outcome,
|
outcome,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user