From b67a26ad61cde4c7a104d2ba0e7fb5c468510d9e Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 19 Aug 2022 16:51:52 -0500 Subject: [PATCH] Don't show bets streak modal on navigate each tab --- web/components/user-page.tsx | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/web/components/user-page.tsx b/web/components/user-page.tsx index 62f73bf8..407983fc 100644 --- a/web/components/user-page.tsx +++ b/web/components/user-page.tsx @@ -70,10 +70,25 @@ export function UserPage(props: { user: User }) { useEffect(() => { const claimedMana = router.query['claimed-mana'] === 'yes' - setShowConfetti(claimedMana) const showBettingStreak = router.query['show'] === 'betting-streak' setShowBettingStreakModal(showBettingStreak) - }, [router]) + setShowConfetti(claimedMana || showBettingStreak) + + const query = { ...router.query } + if (query.claimedMana || query.show) { + delete query['claimed-mana'] + delete query['show'] + router.replace( + { + pathname: router.pathname, + query, + }, + undefined, + { shallow: true } + ) + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []) const profit = user.profitCached.allTime @@ -84,10 +99,9 @@ export function UserPage(props: { user: User }) { description={user.bio ?? ''} url={`/${user.username}`} /> - {showConfetti || - (showBettingStreakModal && ( - - ))} + {showConfetti && ( + + )}