From 4f524bd2a76cd94f14f0d0cd33c35f961a5dd1b4 Mon Sep 17 00:00:00 2001 From: Manikanta cheepurupalli <62022514+Manikanta528@users.noreply.github.com> Date: Thu, 17 Aug 2023 02:57:58 +0530 Subject: [PATCH] Task update sync issue #1203 (#1232) * Task update sync issue #1203 * removed unwanted state --- front/src/modules/activities/hooks/useCompleteTask.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/front/src/modules/activities/hooks/useCompleteTask.ts b/front/src/modules/activities/hooks/useCompleteTask.ts index e50d00f604..2e64597a20 100644 --- a/front/src/modules/activities/hooks/useCompleteTask.ts +++ b/front/src/modules/activities/hooks/useCompleteTask.ts @@ -1,11 +1,13 @@ import { useCallback } from 'react'; import { useApolloClient } from '@apollo/client'; +import { getOperationName } from '@apollo/client/utilities'; import { Activity, useUpdateActivityMutation } from '~/generated/graphql'; import { ACTIVITY_UPDATE_FRAGMENT } from '../graphql/fragments/activityUpdateFragment'; +import { GET_ACTIVITIES } from '../graphql/queries/getActivities'; -type Task = Pick; +type Task = Pick; export function useCompleteTask(task: Task) { const [updateActivityMutation] = useUpdateActivityMutation(); @@ -33,6 +35,7 @@ export function useCompleteTask(task: Task) { completedAt, }, }, + refetchQueries: [getOperationName(GET_ACTIVITIES) ?? ''], }); }, [cachedTask, task.id, updateActivityMutation],