Skip to content

Commit 408e776

Browse files
committed
fix: notification count query in header
1 parent fdfedb4 commit 408e776

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/components/base/Header.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,26 @@ import media from '../../lib/styles/media';
1212
import HeaderLogo from './HeaderLogo';
1313
import { themedPalette } from '../../lib/styles/themes';
1414
import VLink from '../common/VLink';
15-
import { useDispatch } from 'react-redux';
15+
import { useDispatch, useSelector } from 'react-redux';
1616
import { showAuthModal } from '../../modules/core';
1717
import { useQuery } from '@apollo/react-hooks';
1818
import { NOTIFICATION_COUNT } from '../../lib/graphql/notification';
19+
import { RootState } from '../../modules';
1920

2021
export type MainHeaderProps = {};
2122

2223
function Header(props: MainHeaderProps) {
2324
const dispatch = useDispatch();
24-
const { data: notificationCountData, refetch } = useQuery(NOTIFICATION_COUNT);
2525

2626
const { user, onLoginClick, onLogout, customHeader } = useHeader();
27+
const { data: notificationCountData, refetch } = useQuery(
28+
NOTIFICATION_COUNT,
29+
{
30+
fetchPolicy: 'network-only',
31+
skip: !user,
32+
},
33+
);
34+
2735
const [userMenu, toggleUserMenu] = useToggle(false);
2836
const ref = useRef<HTMLDivElement>(null);
2937

0 commit comments

Comments
 (0)