# Introduction closes https://github.com/twentyhq/twenty/issues/12721 Regression seems to be introduced by https://github.com/twentyhq/twenty/pull/12653 ## Post mortem ### Previously No mapping on `namePlural` dynamic response data key ```ts const rawResult = await fetchMore({ variables: { lastCursor: lastCursor, limit, }, }); ``` ### Now Mapping is done by the tool we're consuming already ```ts const rawResult = await fetchMoreRecordsLazy(); // const fetchMoreRecordsLazy = useRecoilCallback( ({ snapshot, set }) => async () => { //... return { data: fetchMoreDataResult?.[objectMetadataItem.namePlural], totalCount: fetchMoreDataResult?.[objectMetadataItem.namePlural] ?.totalCount, records: getRecordsFromRecordConnection({ recordConnection: { edges: fetchMoreDataResult?.[objectMetadataItem.namePlural]?.edges, pageInfo: fetchMoreDataResult?.[objectMetadataItem.namePlural] ?.pageInfo, }, }) as T[], ``` ## Concerns TypeScript did not throw any errors because `RecordConnectionGql` is typed as any, we should consider adding a generic type defaulted to unknown ```ts import { RecordGqlEdge } from '@/object-record/graphql/types/RecordGqlEdge'; import { Nullable } from 'twenty-ui/utilities'; export type RecordGqlConnection = { __typename?: string; edges: RecordGqlEdge[]; pageInfo: { __typename?: string; hasNextPage?: boolean; hasPreviousPage?: boolean; startCursor?: Nullable<string>; endCursor?: Nullable<string>; totalCount?: number; }; totalCount?: number; [aggregateFieldName: string]: any; // Any is problematic here should be unknown }; ``` Example: ```ts export type RecordGqlConnection< T extends Record<string, unknown> = Record<string, unknown>, > = { __typename?: string; edges: RecordGqlEdge[]; pageInfo: { __typename?: string; hasNextPage?: boolean; hasPreviousPage?: boolean; startCursor?: Nullable<string>; endCursor?: Nullable<string>; totalCount?: number; }; totalCount?: number; } & T; ```
Run yarn dev while server running on port 3000