activity, withoutAnteBets: check for undefined

This commit is contained in:
mantikoros 2022-01-22 11:15:04 -06:00
parent b95dfa0a33
commit 4698d119b4
2 changed files with 4 additions and 3 deletions

View File

@ -52,10 +52,11 @@ export function listenForUserBets(
})
}
export function withoutAnteBets(contract: Contract, bets: Bet[]) {
export function withoutAnteBets(contract: Contract, bets?: Bet[]) {
const { createdTime } = contract
if (
bets &&
bets.length >= 2 &&
bets[0].createdTime === createdTime &&
bets[1].createdTime === createdTime
@ -63,5 +64,5 @@ export function withoutAnteBets(contract: Contract, bets: Bet[]) {
return bets.slice(2)
}
return bets
return bets ?? []
}

View File

@ -77,7 +77,7 @@ export function ActivityFeed(props: {
<div key={contract.id} className="py-6 px-2 sm:px-4">
<ContractFeed
contract={contract}
bets={contractBets[i]}
bets={contractBets[i] ?? []}
comments={contractComments[i]}
feedType="activity"
/>