Fix: stop polling notifications after logout
This commit is contained in:
parent
7657da5e16
commit
952113e3d8
1 changed files with 6 additions and 1 deletions
|
|
@ -69,7 +69,7 @@ const Header = memo(({ tree, user }) => {
|
|||
const [active, setActive] = useState()
|
||||
const [hasUnread, setHasUnread] = useState(false)
|
||||
|
||||
const { data, refetch } = useQuery(HAS_UNREAD, { pollInterval: 60000 })
|
||||
const { data, refetch, startPolling, stopPolling } = useQuery(HAS_UNREAD)
|
||||
const notifCenterButtonRef = useRef()
|
||||
const popperRef = useRef()
|
||||
const history = useHistory()
|
||||
|
|
@ -81,6 +81,11 @@ const Header = memo(({ tree, user }) => {
|
|||
if (notNil(data?.hasUnreadNotifications)) return setHasUnread(false)
|
||||
}, [data])
|
||||
|
||||
useEffect(() => {
|
||||
startPolling(60000)
|
||||
return stopPolling
|
||||
})
|
||||
|
||||
const onPaired = machine => {
|
||||
setOpen(false)
|
||||
history.push('/maintenance/machine-status', { id: machine.deviceId })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue