Some fixes required: - [Aggregate value should not disappear when dropdown is open](https://discord.com/channels/1130383047699738754/1319328950475817001/1319328950475817001) - [Delay the apparition of the tooltip on kanban](https://discord.com/channels/1130383047699738754/1319327824632352860/1319327824632352860) - [Group options in sub-menus](https://discord.com/channels/1130383047699738754/1319326443951362059/1319326443951362059)  - Display the currently selected option with a checkmark  - [Loading -> Aggregates should appear at the same time that records, not before](https://discord.com/channels/1130383047699738754/1319329819749646456/1319329899630301318)
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
|
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
|
import { useUpdateView } from '@/views/hooks/useUpdateView';
|
|
import { currentViewIdComponentState } from '@/views/states/currentViewIdComponentState';
|
|
import { useCallback } from 'react';
|
|
|
|
export const useUpdateViewAggregate = () => {
|
|
const currentViewId = useRecoilComponentValueV2(currentViewIdComponentState);
|
|
const { updateView } = useUpdateView();
|
|
const updateViewAggregate = useCallback(
|
|
({
|
|
kanbanAggregateOperationFieldMetadataId,
|
|
kanbanAggregateOperation,
|
|
}: {
|
|
kanbanAggregateOperationFieldMetadataId: string | null;
|
|
kanbanAggregateOperation: AGGREGATE_OPERATIONS | null;
|
|
}) =>
|
|
updateView({
|
|
id: currentViewId,
|
|
kanbanAggregateOperationFieldMetadataId,
|
|
kanbanAggregateOperation,
|
|
}),
|
|
[currentViewId, updateView],
|
|
);
|
|
|
|
return {
|
|
updateViewAggregate,
|
|
};
|
|
};
|