From b303f4bca3198f444718a33a70b9bf2e61702fde Mon Sep 17 00:00:00 2001 From: Lucas Bordeau Date: Wed, 15 Jan 2025 19:31:09 +0100 Subject: [PATCH] Fixed CI and removed unused code --- .../hooks/useCombinedFindManyRecords.ts | 26 ++++--------------- .../src/testing/decorators/PageDecorator.tsx | 9 ++++++- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/multiple-objects/hooks/useCombinedFindManyRecords.ts b/packages/twenty-front/src/modules/object-record/multiple-objects/hooks/useCombinedFindManyRecords.ts index 6c07c7afdc53..b147b5535f71 100644 --- a/packages/twenty-front/src/modules/object-record/multiple-objects/hooks/useCombinedFindManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/multiple-objects/hooks/useCombinedFindManyRecords.ts @@ -5,28 +5,24 @@ import { EMPTY_QUERY } from '@/object-record/constants/EmptyQuery'; import { RecordGqlOperationSignature } from '@/object-record/graphql/types/RecordGqlOperationSignature'; import { useGenerateCombinedFindManyRecordsQuery } from '@/object-record/multiple-objects/hooks/useGenerateCombinedFindManyRecordsQuery'; import { MultiObjectRecordQueryResult } from '@/object-record/relation-picker/hooks/useMultiObjectRecordsQueryResultFormattedAsObjectRecordForSelectArray'; -import { useEffect, useMemo } from 'react'; -import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; export const useCombinedFindManyRecords = ({ operationSignatures, skip = false, - onDataChange, }: { operationSignatures: RecordGqlOperationSignature[]; skip?: boolean; - onDataChange?: ( - data: MultiObjectRecordQueryResult | null | undefined, - ) => void; }) => { const findManyQuery = useGenerateCombinedFindManyRecordsQuery({ operationSignatures, }); - const { data, loading, previousData } = - useQuery(findManyQuery ?? EMPTY_QUERY, { + const { data, loading } = useQuery( + findManyQuery ?? EMPTY_QUERY, + { skip, - }); + }, + ); const resultWithoutConnection = Object.fromEntries( Object.entries(data ?? {}).map(([namePlural, objectRecordConnection]) => [ @@ -37,20 +33,8 @@ export const useCombinedFindManyRecords = ({ ]), ); - const isSameDataAsPreviousData = useMemo( - () => isDeeplyEqual(previousData, data), - [previousData, data], - ); - - useEffect(() => { - if (!isSameDataAsPreviousData) { - onDataChange?.(data); - } - }, [isSameDataAsPreviousData, onDataChange, data]); - return { result: resultWithoutConnection, loading, - isSameDataAsPreviousData, }; }; diff --git a/packages/twenty-front/src/testing/decorators/PageDecorator.tsx b/packages/twenty-front/src/testing/decorators/PageDecorator.tsx index 1fcbce56fbc2..32883f5a9a11 100644 --- a/packages/twenty-front/src/testing/decorators/PageDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/PageDecorator.tsx @@ -22,6 +22,7 @@ import { mockedApolloClient } from '~/testing/mockedApolloClient'; import { RecoilDebugObserverEffect } from '@/debug/components/RecoilDebugObserver'; import { ObjectMetadataItemsProvider } from '@/object-metadata/components/ObjectMetadataItemsProvider'; +import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; import { PrefetchDataProvider } from '@/prefetch/components/PrefetchDataProvider'; import { WorkspaceProviderEffect } from '@/workspace/components/WorkspaceProviderEffect'; import { IconsProvider } from 'twenty-ui'; @@ -82,7 +83,13 @@ const Providers = () => { - + + +