From a17df14dceadf21753bbe490051ff633427d1e9e Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Thu, 28 Apr 2022 15:29:06 -0600 Subject: [PATCH] Just check once --- web/pages/[username]/[contractSlug].tsx | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/web/pages/[username]/[contractSlug].tsx b/web/pages/[username]/[contractSlug].tsx index 8b98fae5..6e6e4523 100644 --- a/web/pages/[username]/[contractSlug].tsx +++ b/web/pages/[username]/[contractSlug].tsx @@ -95,20 +95,13 @@ export function ContractPageContent(props: FirstArgument) { const [showConfetti, setShowConfetti] = useState(false) useEffect(() => { - const timer = setInterval(() => { - const shouldSeeConfetti = !!( - user && - contract && - contract.creatorId === user.id && - Date.now() - contract.createdTime < 10 * 1000 - ) - setShowConfetti(shouldSeeConfetti) - // Don't erase confetti mid-animation - if (shouldSeeConfetti) clearInterval(timer) - }, 1000) - return () => { - clearInterval(timer) - } + const shouldSeeConfetti = !!( + user && + contract && + contract.creatorId === user.id && + Date.now() - contract.createdTime < 10 * 1000 + ) + setShowConfetti(shouldSeeConfetti) }, [contract, user]) // Sort for now to see if bug is fixed.