The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix`useLazyFetchAllRecords` any wrong infer (#12728)
Paul Rastoin4da0152c33af
diff --git a/packages/twenty-front/src/modules/object-record/hooks/useLazyFetchAllRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useLazyFetchAllRecords.tsindex c8dfbbe4925..483c36f1ea1 100644--- a/packages/twenty-front/src/modules/object-record/hooks/useLazyFetchAllRecords.ts+++ b/packages/twenty-front/src/modules/object-record/hooks/useLazyFetchAllRecords.ts@@ -94,9 +94,9 @@ export const useLazyFetchAllRecords = <T>({const rawResult = await fetchMoreRecordsLazy();- const fetchMoreResult = rawResult?.data?.[objectMetadataItem.namePlural];+ const fetchMoreResult = rawResult?.data;- for (const edge of fetchMoreResult.edges) {+ for (const edge of fetchMoreResult?.edges ?? []) {records.push(edge.node);}@@ -106,11 +106,11 @@ export const useLazyFetchAllRecords = <T>({displayType: totalCount ? 'percentage' : 'number',});- if (fetchMoreResult.pageInfo.hasNextPage === false) {+ if (fetchMoreResult?.pageInfo.hasNextPage === false) {break;}- lastCursor = fetchMoreResult.pageInfo.endCursor ?? null;+ lastCursor = fetchMoreResult?.pageInfo.endCursor ?? null;}setIsDownloading(false);