continue notification polling even if found

This commit is contained in:
keyan 2023-10-26 11:53:00 -05:00
parent cbcf80e1ba
commit 41cb6ac3d8
1 changed files with 7 additions and 14 deletions

View File

@ -19,7 +19,7 @@ import LightningIcon from '../svgs/bolt.svg'
import { Select } from './form' import { Select } from './form'
import SearchIcon from '../svgs/search-line.svg' import SearchIcon from '../svgs/search-line.svg'
import BackArrow from '../svgs/arrow-left-line.svg' import BackArrow from '../svgs/arrow-left-line.svg'
import { SUBS } from '../lib/constants' import { SSR, SUBS } from '../lib/constants'
import { useLightning } from './lightning' import { useLightning } from './lightning'
import { HAS_NOTIFICATIONS } from '../fragments/notifications' import { HAS_NOTIFICATIONS } from '../fragments/notifications'
import AnonIcon from '../svgs/spy-fill.svg' import AnonIcon from '../svgs/spy-fill.svg'
@ -52,19 +52,12 @@ function Back () {
} }
function NotificationBell () { function NotificationBell () {
const { data, startPolling, stopPolling } = useQuery(HAS_NOTIFICATIONS, { const { data } = useQuery(HAS_NOTIFICATIONS, SSR
nextFetchPolicy: 'cache-and-network' ? {}
}) : {
pollInterval: 30000,
// fine controlled polling nextFetchPolicy: 'cache-and-network'
useEffect(() => { })
if (data?.hasNewNotes) {
stopPolling()
} else {
startPolling(30000)
}
return stopPolling
}, [data?.hasNewNotes, startPolling, stopPolling])
return ( return (
<> <>