Don't use interval
This commit is contained in:
parent
8be20a753a
commit
4723edb1b8
|
@ -14,15 +14,13 @@ export default function NotificationsIcon(props: { className?: string }) {
|
|||
const privateUser = usePrivateUser(user?.id)
|
||||
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
const bonusChecker = setInterval(() => {
|
||||
requestBonuses({}).catch(console.log)
|
||||
return () => {
|
||||
clearInterval(bonusChecker)
|
||||
}
|
||||
}, 1000 * 65)
|
||||
}
|
||||
}, [user])
|
||||
if (
|
||||
privateUser &&
|
||||
privateUser.lastTimeCheckedBonuses &&
|
||||
Date.now() - privateUser.lastTimeCheckedBonuses > 1000 * 70
|
||||
)
|
||||
requestBonuses({}).catch(console.log)
|
||||
}, [privateUser])
|
||||
|
||||
return (
|
||||
<Row className={clsx('justify-center')}>
|
||||
|
|
|
@ -102,9 +102,14 @@ function NotificationsList(props: { privateUser: PrivateUser }) {
|
|||
if (!paginatedGroupedNotifications) return <LoadingIndicator />
|
||||
|
||||
return (
|
||||
<Col className={'min-h-screen'}>
|
||||
{paginatedGroupedNotifications.length === 0 &&
|
||||
"You don't have any notifications. Try changing your settings to see more."}
|
||||
<div className={'min-h-[100vh]'}>
|
||||
{paginatedGroupedNotifications.length === 0 && (
|
||||
<div className={'mt-2'}>
|
||||
You don't have any notifications. Try changing your settings to see
|
||||
more.
|
||||
</div>
|
||||
)}
|
||||
|
||||
{paginatedGroupedNotifications.map((notification) =>
|
||||
notification.type === 'income' ? (
|
||||
<IncomeNotificationGroupItem
|
||||
|
@ -168,7 +173,7 @@ function NotificationsList(props: { privateUser: PrivateUser }) {
|
|||
</div>
|
||||
</nav>
|
||||
)}
|
||||
</Col>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user