From b8374f5531cec0a3cd7d531e6f989b6d64937693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bosi?= <71827178+bosiraphael@users.noreply.github.com> Date: Mon, 30 Mar 2026 15:07:24 +0200 Subject: [PATCH] Fix export view (#19117) # PR Description **Export view** command sent { id: { in: [] } } to the server, which rejects empty arrays. It now falls back to the view's filters instead when there is no selection, which is the intended behavior. # Video QA ## Before https://github.com/user-attachments/assets/3e6263f9-9c66-4f67-a81e-e0571652147d ## After https://github.com/user-attachments/assets/977a366d-1936-457f-96a1-a5d4fb8ac98e --- .../export/hooks/useRecordIndexLazyFetchRecords.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords.ts b/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords.ts index 0462e85716..3fb8b893ee 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords.ts @@ -92,7 +92,11 @@ export const useRecordIndexLazyFetchRecords = ({ recordIndexId, ); - const queryFilter = computeContextStoreFilters({ + const isEmptySelection = + contextStoreTargetedRecordsRule.mode === 'selection' && + contextStoreTargetedRecordsRule.selectedRecordIds.length === 0; + + const contextStoreFilter = computeContextStoreFilters({ contextStoreTargetedRecordsRule, contextStoreFilters, contextStoreFilterGroups, @@ -101,6 +105,10 @@ export const useRecordIndexLazyFetchRecords = ({ contextStoreAnyFieldFilterValue, }); + const queryFilter = isEmptySelection + ? findManyRecordsParams.filter + : contextStoreFilter; + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, recordIndexId,