Skip to content

The open alternative to Salesforce, designed for AI.

Fixed board total count on view picker button (#10612)

Lucas Bordeauc5795b7325b4
diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useSetRecordIdsForColumn.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useSetRecordIdsForColumn.ts
index 1d1bf6ab90b..c68bd51f407 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useSetRecordIdsForColumn.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useSetRecordIdsForColumn.ts
@@ -2,6 +2,7 @@ import { useRecoilCallback } from 'recoil';
import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState';
import { recordGroupFieldMetadataComponentState } from '@/object-record/record-group/states/recordGroupFieldMetadataComponentState';
+import { useSetRecordIndexEntityCount } from '@/object-record/record-index/hooks/useSetRecordIndexEntityCount';
import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState';
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
@@ -21,6 +22,9 @@ export const useSetRecordIdsForColumn = (recordBoardId?: string) => {
recordBoardId,
);
+ const { setRecordIndexEntityCount } =
+ useSetRecordIndexEntityCount(recordBoardId);
+
const setRecordIdsForColumn = useRecoilCallback(
({ set, snapshot }) =>
(currentRecordGroupId: string, records: ObjectRecord[]) => {
@@ -55,9 +59,18 @@ export const useSetRecordIdsForColumn = (recordBoardId?: string) => {
recordIndexRecordIdsByGroupFamilyState(currentRecordGroupId),
recordGroupRowIds,
);
+
+ setRecordIndexEntityCount(
+ recordGroupRowIds.length,
+ currentRecordGroupId,
+ );
}
},
- [recordIndexRecordIdsByGroupFamilyState, recordGroupFieldMetadataState],
+ [
+ recordIndexRecordIdsByGroupFamilyState,
+ recordGroupFieldMetadataState,
+ setRecordIndexEntityCount,
+ ],
);
return {