Memoize bets tab

This commit is contained in:
Marshall Polaris 2022-09-20 21:41:15 -07:00
parent 2551c41902
commit 732656049b

View File

@ -57,7 +57,7 @@ export function ContractTabs(props: { contract: Contract; bets: Bet[] }) {
},
{
title: capitalize(PAST_BETS),
content: <ContractBetsActivity contract={contract} bets={bets} />,
content: <BetsTabContent contract={contract} bets={bets} />,
},
...(!user || !userBets?.length
? []
@ -151,7 +151,10 @@ const CommentsTabContent = memo(function CommentsTabContent(props: {
}
})
function ContractBetsActivity(props: { contract: Contract; bets: Bet[] }) {
const BetsTabContent = memo(function BetsTabContent(props: {
contract: Contract
bets: Bet[]
}) {
const { contract, bets } = props
const [page, setPage] = useState(0)
const ITEMS_PER_PAGE = 50
@ -213,4 +216,4 @@ function ContractBetsActivity(props: { contract: Contract; bets: Bet[] }) {
/>
</>
)
}
})