Skip to content

Commit

Permalink
Fix: swap manual refetch to disable refetchOnWindowFocus instead
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderleegs committed Oct 18, 2022
1 parent e28c2c4 commit 01641dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/hooks/commentsHooks/useGetComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const useGetComments = ({
() => CommentsService.getComments({ siteName, requestId }),
{
retry: false,
enabled: false, // Manually triggered
refetchOnWindowFocus: false,
}
)
}
11 changes: 1 addition & 10 deletions src/layouts/ReviewRequest/components/Comments/CommentsDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ export const CommentsDrawer = ({ siteName, requestId }: CommentProps) => {
onClose: onCommentsClose,
} = useDisclosure()

const {
data: commentsData,
isLoading: isCommentsLoading,
refetch: refetchRecentNotificationData,
} = useGetComments({
const { data: commentsData, isLoading: isCommentsLoading } = useGetComments({
siteName,
requestId,
})
Expand All @@ -95,11 +91,6 @@ export const CommentsDrawer = ({ siteName, requestId }: CommentProps) => {
await updateNotifications({ siteName, requestId, message: comment })
}

useEffect(() => {
refetchRecentNotificationData()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

return (
<>
<IconButton
Expand Down

0 comments on commit 01641dd

Please sign in to comment.