From 4698d119b47b55f9cd25e11b0dc971f068d6d60b Mon Sep 17 00:00:00 2001 From: mantikoros Date: Sat, 22 Jan 2022 11:15:04 -0600 Subject: [PATCH] activity, withoutAnteBets: check for undefined --- web/lib/firebase/bets.ts | 5 +++-- web/pages/activity.tsx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/web/lib/firebase/bets.ts b/web/lib/firebase/bets.ts index 287a98a2..982d4f89 100644 --- a/web/lib/firebase/bets.ts +++ b/web/lib/firebase/bets.ts @@ -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 ?? [] } diff --git a/web/pages/activity.tsx b/web/pages/activity.tsx index 359990dd..319dde6c 100644 --- a/web/pages/activity.tsx +++ b/web/pages/activity.tsx @@ -77,7 +77,7 @@ export function ActivityFeed(props: {