Just check once

This commit is contained in:
Ian Philips 2022-04-28 15:29:06 -06:00
parent cc5862ff4a
commit a17df14dce

View File

@ -95,20 +95,13 @@ export function ContractPageContent(props: FirstArgument<typeof ContractPage>) {
const [showConfetti, setShowConfetti] = useState(false) const [showConfetti, setShowConfetti] = useState(false)
useEffect(() => { useEffect(() => {
const timer = setInterval(() => { const shouldSeeConfetti = !!(
const shouldSeeConfetti = !!( user &&
user && contract &&
contract && contract.creatorId === user.id &&
contract.creatorId === user.id && Date.now() - contract.createdTime < 10 * 1000
Date.now() - contract.createdTime < 10 * 1000 )
) setShowConfetti(shouldSeeConfetti)
setShowConfetti(shouldSeeConfetti)
// Don't erase confetti mid-animation
if (shouldSeeConfetti) clearInterval(timer)
}, 1000)
return () => {
clearInterval(timer)
}
}, [contract, user]) }, [contract, user])
// Sort for now to see if bug is fixed. // Sort for now to see if bug is fixed.