From 339814f3eff4238b77b87d82d662e5ccd9ee8c9c Mon Sep 17 00:00:00 2001 From: sajjad isvand Date: Thu, 13 Aug 2026 18:33:11 +0330 Subject: [PATCH] fix(notifications): invalidate notifications query after marking as seen --- src/services/hooks/extension/get-notifications.hook.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/hooks/extension/get-notifications.hook.ts b/src/services/hooks/extension/get-notifications.hook.ts index 763b05f7..ddc29653 100644 --- a/src/services/hooks/extension/get-notifications.hook.ts +++ b/src/services/hooks/extension/get-notifications.hook.ts @@ -1,4 +1,4 @@ -import { useMutation, useQuery } from '@tanstack/react-query' +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { getMainClient } from '@/services/api' import { getFromStorage, setToStorage } from '@/common/storage' @@ -84,11 +84,17 @@ export function useGetNotifications() { } export function useNotifyAsSeen() { + const queryClient = useQueryClient() return useMutation({ mutationFn: async (id: string) => { const client = getMainClient() await client.put(`/notifications/${id}/seen`) }, + onSuccess: () => { + queryClient.invalidateQueries({ + queryKey: ['notifications'], + }) + }, mutationKey: ['seen_notification'], }) }