From 9d8f04df5f3bf6424347586809ee8903e45841d8 Mon Sep 17 00:00:00 2001 From: Weiko Date: Mon, 30 Sep 2024 15:45:17 +0200 Subject: [PATCH] increase export feature page size (#7341) ## Context Now that we have improved performances, we can increase the export feature page size from 30 to 200 (and probably above if results are good). This should be ok since we are only querying the first level of an object and omit relations. I've moved this value to a constant. --- .../options/constants/ExportTableDataDefaultPageSize.ts | 1 + .../record-index/options/hooks/useExportTableData.ts | 3 ++- .../object-record/record-index/options/hooks/useTableData.ts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 packages/twenty-front/src/modules/object-record/record-index/options/constants/ExportTableDataDefaultPageSize.ts diff --git a/packages/twenty-front/src/modules/object-record/record-index/options/constants/ExportTableDataDefaultPageSize.ts b/packages/twenty-front/src/modules/object-record/record-index/options/constants/ExportTableDataDefaultPageSize.ts new file mode 100644 index 000000000000..1a58deeb28ba --- /dev/null +++ b/packages/twenty-front/src/modules/object-record/record-index/options/constants/ExportTableDataDefaultPageSize.ts @@ -0,0 +1 @@ +export const EXPORT_TABLE_DATA_DEFAULT_PAGE_SIZE = 200; diff --git a/packages/twenty-front/src/modules/object-record/record-index/options/hooks/useExportTableData.ts b/packages/twenty-front/src/modules/object-record/record-index/options/hooks/useExportTableData.ts index 8a535604dee8..532b8e0aa59b 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/options/hooks/useExportTableData.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/options/hooks/useExportTableData.ts @@ -2,6 +2,7 @@ import { json2csv } from 'json-2-csv'; import { useMemo } from 'react'; import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata'; +import { EXPORT_TABLE_DATA_DEFAULT_PAGE_SIZE } from '@/object-record/record-index/options/constants/ExportTableDataDefaultPageSize'; import { useProcessRecordsForCSVExport } from '@/object-record/record-index/options/hooks/useProcessRecordsForCSVExport'; import { useTableData, @@ -142,7 +143,7 @@ export const useExportTableData = ({ filename, maximumRequests = 100, objectNameSingular, - pageSize = 30, + pageSize = EXPORT_TABLE_DATA_DEFAULT_PAGE_SIZE, recordIndexId, viewType, }: UseExportTableDataOptions) => { diff --git a/packages/twenty-front/src/modules/object-record/record-index/options/hooks/useTableData.ts b/packages/twenty-front/src/modules/object-record/record-index/options/hooks/useTableData.ts index 1e6255276919..98294115c5d2 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/options/hooks/useTableData.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/options/hooks/useTableData.ts @@ -9,6 +9,7 @@ import { ObjectRecord } from '@/object-record/types/ObjectRecord'; import { isDefined } from '~/utils/isDefined'; import { useRecordBoardStates } from '@/object-record/record-board/hooks/internal/useRecordBoardStates'; +import { EXPORT_TABLE_DATA_DEFAULT_PAGE_SIZE } from '@/object-record/record-index/options/constants/ExportTableDataDefaultPageSize'; import { useRecordIndexOptionsForBoard } from '@/object-record/record-index/options/hooks/useRecordIndexOptionsForBoard'; import { ViewType } from '@/views/types/ViewType'; import { useFindManyParams } from '../../hooks/useLoadRecordIndexTable'; @@ -43,7 +44,7 @@ export const useTableData = ({ delayMs, maximumRequests = 100, objectNameSingular, - pageSize = 30, + pageSize = EXPORT_TABLE_DATA_DEFAULT_PAGE_SIZE, recordIndexId, callback, viewType = ViewType.Table,