From 411266475defb7acc1da8f2cf4823eb89edfec0c Mon Sep 17 00:00:00 2001 From: Lucas Bordeau Date: Thu, 20 Jul 2023 00:02:41 +0200 Subject: [PATCH] Fixed refetch query (#760) --- .../modules/companies/components/CompanyEditableNameCell.tsx | 4 ++++ .../people/table/components/EditablePeopleFullNameCell.tsx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/front/src/modules/companies/components/CompanyEditableNameCell.tsx b/front/src/modules/companies/components/CompanyEditableNameCell.tsx index 9928981fd4..402ac6f78c 100644 --- a/front/src/modules/companies/components/CompanyEditableNameCell.tsx +++ b/front/src/modules/companies/components/CompanyEditableNameCell.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from 'react'; +import { getOperationName } from '@apollo/client/utilities'; import { EditableCellChip } from '@/ui/table/editable-cell/types/EditableChip'; import { @@ -7,6 +8,8 @@ import { } from '~/generated/graphql'; import { getLogoUrlFromDomainName } from '~/utils'; +import { GET_COMPANY } from '../queries'; + import { CompanyChip } from './CompanyChip'; type OwnProps = { @@ -44,6 +47,7 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) { id: company.id, name: internalValue, }, + refetchQueries: [getOperationName(GET_COMPANY) ?? ''], }) } onCancel={() => setInternalValue(company.name ?? '')} diff --git a/front/src/modules/people/table/components/EditablePeopleFullNameCell.tsx b/front/src/modules/people/table/components/EditablePeopleFullNameCell.tsx index 64642b7bc2..939c4d1af5 100644 --- a/front/src/modules/people/table/components/EditablePeopleFullNameCell.tsx +++ b/front/src/modules/people/table/components/EditablePeopleFullNameCell.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from 'react'; +import { getOperationName } from '@apollo/client/utilities'; import { useRecoilValue } from 'recoil'; import { EditablePeopleFullName } from '@/people/components/EditablePeopleFullName'; @@ -6,6 +7,8 @@ import { peopleNameCellFamilyState } from '@/people/states/peopleNamesFamilyStat import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId'; import { useUpdatePeopleMutation } from '~/generated/graphql'; +import { GET_PERSON } from '../../queries'; + export function EditablePeopleFullNameCell() { const currentRowEntityId = useCurrentRowEntityId(); @@ -42,6 +45,7 @@ export function EditablePeopleFullNameCell() { firstName: internalFirstName, lastName: internalLastName, }, + refetchQueries: [getOperationName(GET_PERSON) ?? ''], }) } onCancel={() => {