From 96ea32513607dc49e3ec783cd1a3995d3915a62c Mon Sep 17 00:00:00 2001 From: James Grugett Date: Thu, 17 Feb 2022 17:39:18 -0600 Subject: [PATCH] Sort initial bets --- web/hooks/use-bets.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/web/hooks/use-bets.ts b/web/hooks/use-bets.ts index 4d892ff6..0b6b9293 100644 --- a/web/hooks/use-bets.ts +++ b/web/hooks/use-bets.ts @@ -12,12 +12,11 @@ export const useBets = (contractId: string) => { return bets } -export const useBetsWithoutAntes = ( - contract: Contract, - initialBets?: Bet[] -) => { - const [bets, setBets] = useState( - withoutAnteBets(contract, initialBets) +export const useBetsWithoutAntes = (contract: Contract, initialBets: Bet[]) => { + const [bets, setBets] = useState( + withoutAnteBets(contract, initialBets).sort( + (bet1, bet2) => bet1.createdTime - bet2.createdTime + ) ) useEffect(() => {