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)
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.