Skip to content

The open alternative to Salesforce, designed for AI.

Fix update of aggregate operation not reflected in kanban header without refresh (#10879)

Weiko46c773e5ff39
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateDropdownState.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateDropdownState.ts
deleted file mode 100644
index 310f9db0d8d..00000000000
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateDropdownState.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { createState } from '@ui/utilities/state/utils/createState';
-
-type AggregateOperation = {
- operation: AGGREGATE_OPERATIONS | null;
- availableFieldIdsForOperation: string[];
-};
-
-export const aggregateDropdownState = createState<AggregateOperation>({
- key: 'aggregateDropdownState',
- defaultValue: {
- operation: null,
- availableFieldIdsForOperation: [],
- },
-});
diff --git a/packages/twenty-front/src/modules/views/hooks/useUpdateViewAggregate.ts b/packages/twenty-front/src/modules/views/hooks/useUpdateViewAggregate.ts
index e65cbbbfc3c..f2165f8b424 100644
--- a/packages/twenty-front/src/modules/views/hooks/useUpdateViewAggregate.ts
+++ b/packages/twenty-front/src/modules/views/hooks/useUpdateViewAggregate.ts
@@ -1,15 +1,22 @@
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
+import { recordIndexKanbanAggregateOperationState } from '@/object-record/record-index/states/recordIndexKanbanAggregateOperationState';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
import { convertExtendedAggregateOperationToAggregateOperation } from '@/object-record/utils/convertExtendedAggregateOperationToAggregateOperation';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useUpdateView } from '@/views/hooks/useUpdateView';
import { useCallback } from 'react';
+import { useSetRecoilState } from 'recoil';
export const useUpdateViewAggregate = () => {
const currentViewId = useRecoilComponentValueV2(
contextStoreCurrentViewIdComponentState,
);
const { updateView } = useUpdateView();
+
+ const setRecordIndexKanbanAggregateOperationState = useSetRecoilState(
+ recordIndexKanbanAggregateOperationState,
+ );
+
const updateViewAggregate = useCallback(
({
kanbanAggregateOperationFieldMetadataId,
@@ -27,8 +34,13 @@ export const useUpdateViewAggregate = () => {
kanbanAggregateOperationFieldMetadataId,
kanbanAggregateOperation: convertedKanbanAggregateOperation,
});
+
+ setRecordIndexKanbanAggregateOperationState({
+ operation: convertedKanbanAggregateOperation,
+ fieldMetadataId: kanbanAggregateOperationFieldMetadataId,
+ });
},
- [currentViewId, updateView],
+ [currentViewId, updateView, setRecordIndexKanbanAggregateOperationState],
);
return {