Fix update of aggregate operation not reflected in kanban header without refresh (#10879)
Before https://github.com/user-attachments/assets/1761c49e-3d08-413a-bebd-11f4592a7de8 After https://github.com/user-attachments/assets/064ef28f-b131-48af-ad66-11f782298670
This commit is contained in:
@ -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: [],
|
||||
},
|
||||
});
|
||||
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user