From 419a356b88954f794993f4662724d4f0610843bc Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Tue, 17 May 2022 15:43:56 -0600 Subject: [PATCH] Only calculate current users bets once --- web/components/feed/activity-items.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/components/feed/activity-items.ts b/web/components/feed/activity-items.ts index 251849e2..f7a84400 100644 --- a/web/components/feed/activity-items.ts +++ b/web/components/feed/activity-items.ts @@ -279,6 +279,7 @@ function getAnswerAndCommentInputGroups( outcomes = _.sortBy(outcomes, (outcome) => getOutcomeProbability(contract, outcome) ) + const betsByCurrentUser = bets.filter((bet) => bet.userId === user?.id) const answerGroups = outcomes .map((outcome) => { @@ -301,7 +302,7 @@ function getAnswerAndCommentInputGroups( answer, items, user, - betsByCurrentUser: bets.filter((bet) => bet.userId === user?.id), + betsByCurrentUser: betsByCurrentUser, commentsByCurrentUser: answerComments.filter( (comment) => comment.userId === user?.id ),