diff --git a/frontend/src/graphql/mutations/index.ts b/frontend/src/graphql/mutations/index.ts index 5eac0a7e5..9d61af91b 100644 --- a/frontend/src/graphql/mutations/index.ts +++ b/frontend/src/graphql/mutations/index.ts @@ -1,5 +1,6 @@ import { useMutation, MutationHookOptions } from "@apollo/client"; +import MeGql from "../queries/Me.gql"; import { ActivateNewUserMutation, ActivateNewUserMutationVariables, @@ -136,6 +137,7 @@ import { UpdateNotificationSubscriptionsMutation, UpdateNotificationSubscriptionsMutationVariables, MarkNotificationsReadDocument, + MeQuery, } from "../types"; export const useActivateUser = ( @@ -444,8 +446,11 @@ export const useUpdateNotificationSubscriptions = ( useMutation(UpdateNotificationSubscriptionsDocument, { update(cache, { data }) { if (data?.updateNotificationSubscriptions) { + const user = cache.read({ query: MeGql, optimistic: false }); + cache.evict({ - fieldName: "queryNotifications", + id: cache.identify({ __typename: "User", id: user?.me?.id }), + fieldName: "notification_subscriptions", }); } },