From 408e776018b377cd7d48dac18ccb66d688eb9d58 Mon Sep 17 00:00:00 2001 From: carrick Date: Thu, 15 Feb 2024 13:23:13 +0900 Subject: [PATCH 1/2] fix: notification count query in header --- src/components/base/Header.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/base/Header.tsx b/src/components/base/Header.tsx index de2e47a8..c14bb72e 100644 --- a/src/components/base/Header.tsx +++ b/src/components/base/Header.tsx @@ -12,18 +12,26 @@ import media from '../../lib/styles/media'; import HeaderLogo from './HeaderLogo'; import { themedPalette } from '../../lib/styles/themes'; import VLink from '../common/VLink'; -import { useDispatch } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import { showAuthModal } from '../../modules/core'; import { useQuery } from '@apollo/react-hooks'; import { NOTIFICATION_COUNT } from '../../lib/graphql/notification'; +import { RootState } from '../../modules'; export type MainHeaderProps = {}; function Header(props: MainHeaderProps) { const dispatch = useDispatch(); - const { data: notificationCountData, refetch } = useQuery(NOTIFICATION_COUNT); const { user, onLoginClick, onLogout, customHeader } = useHeader(); + const { data: notificationCountData, refetch } = useQuery( + NOTIFICATION_COUNT, + { + fetchPolicy: 'network-only', + skip: !user, + }, + ); + const [userMenu, toggleUserMenu] = useToggle(false); const ref = useRef(null); From 3f58e274c4a6d0a3df54ca6fd45d693ac9881c29 Mon Sep 17 00:00:00 2001 From: carrick Date: Thu, 15 Feb 2024 13:24:30 +0900 Subject: [PATCH 2/2] chore: remove lines --- src/components/base/Header.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/base/Header.tsx b/src/components/base/Header.tsx index c14bb72e..a1387234 100644 --- a/src/components/base/Header.tsx +++ b/src/components/base/Header.tsx @@ -12,11 +12,10 @@ import media from '../../lib/styles/media'; import HeaderLogo from './HeaderLogo'; import { themedPalette } from '../../lib/styles/themes'; import VLink from '../common/VLink'; -import { useDispatch, useSelector } from 'react-redux'; +import { useDispatch } from 'react-redux'; import { showAuthModal } from '../../modules/core'; import { useQuery } from '@apollo/react-hooks'; import { NOTIFICATION_COUNT } from '../../lib/graphql/notification'; -import { RootState } from '../../modules'; export type MainHeaderProps = {};