Skip to content

Commit

Permalink
Skip polling if the user hasn't logged in
Browse files Browse the repository at this point in the history
* Skip polling if the user hasn't logged in
* Increase POLL_INTERVAL to 20s
  • Loading branch information
robertu7 committed Feb 10, 2020
1 parent 7c716c4 commit 46a74ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/common/enums/time.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const POLL_INTERVAL = 1000 * 10
export const POLL_INTERVAL = 1000 * 20

export const INPUT_DEBOUNCE = 300

Expand Down
4 changes: 3 additions & 1 deletion src/components/GlobalHeader/Nav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const Nav = () => {

// FIXME: https://github.com/apollographql/apollo-client/issues/3775
useEffect(() => {
startPolling(POLL_INTERVAL)
if (viewer.isAuthed) {
startPolling(POLL_INTERVAL)
}
}, [])

return (
Expand Down
4 changes: 3 additions & 1 deletion src/components/GlobalHeader/NotificationButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ const NotificationButton = () => {

// FIXME: https://github.com/apollographql/apollo-client/issues/3775
useEffect(() => {
startPolling(POLL_INTERVAL)
if (viewer.isAuthed) {
startPolling(POLL_INTERVAL)
}
}, [])

return (
Expand Down

0 comments on commit 46a74ff

Please sign in to comment.