Task update sync issue #1203 (#1232)

* Task update sync issue #1203

* removed unwanted state
This commit is contained in:
Manikanta cheepurupalli 2023-08-17 02:57:58 +05:30 committed by GitHub
parent a24e1e4dc9
commit 4f524bd2a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<Activity, 'id'>;
type Task = Pick<Activity, 'id' | 'completedAt'>;
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],