From 9eb7335cf67ca1a33457ea6fbf10c65e66ed98ae Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Wed, 4 May 2022 14:10:54 -0700 Subject: [PATCH] Only warm up sell bet function once --- web/components/bets-list.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 5d595cf7..9bad3627 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -553,10 +553,11 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) { ) } +const warmUpSellBet = _.throttle(() => sellBet({}).catch(), 5000 /* ms */) + function SellButton(props: { contract: Contract; bet: Bet }) { useEffect(() => { - // warm up cloud function - sellBet({}).catch() + warmUpSellBet() }, []) const { contract, bet } = props