fix: record group issues (#8854)
This PR is fixing the following issues with record groups: - [x] [Backend] - Only update view groups when a field is edited if this one already has view groups - [x] [Backend] - Editing a Select field metadata option brake view groups - [x] [Frontend] - Changing the group by field from one to another brake record group and doesn't remove the previous ones - [x] [Frontend & Backend] - Mark `kanbanFieldMetadataId` as deprecated in favour of `viewGroups.fieldMetadataId` Also the following has been checked: - [x] Properly displayed a table with only one view groups - [x] Properly displayed a table without view groups
This commit is contained in:
@ -73,11 +73,24 @@ export const useHandleRecordGroupField = ({
|
||||
}) satisfies ViewGroup,
|
||||
);
|
||||
|
||||
const viewGroupsToDelete = view.viewGroups.filter(
|
||||
(group) => group.fieldMetadataId !== fieldMetadataItem.id,
|
||||
);
|
||||
|
||||
if (viewGroupsToCreate.length > 0) {
|
||||
await createViewGroupRecords(viewGroupsToCreate, view);
|
||||
}
|
||||
|
||||
if (viewGroupsToDelete.length > 0) {
|
||||
await deleteViewGroupRecords(viewGroupsToDelete);
|
||||
}
|
||||
},
|
||||
[createViewGroupRecords, currentViewIdCallbackState, getViewFromCache],
|
||||
[
|
||||
createViewGroupRecords,
|
||||
deleteViewGroupRecords,
|
||||
currentViewIdCallbackState,
|
||||
getViewFromCache,
|
||||
],
|
||||
);
|
||||
|
||||
const resetRecordGroupField = useRecoilCallback(
|
||||
|
||||
@ -12,6 +12,9 @@ export type GraphQLView = {
|
||||
name: string;
|
||||
type: ViewType;
|
||||
key: ViewKey | null;
|
||||
/**
|
||||
* @deprecated Use `viewGroups.fieldMetadataId` instead.
|
||||
*/
|
||||
kanbanFieldMetadataId: string;
|
||||
kanbanAggregateOperation?: AGGREGATE_OPERATIONS | null;
|
||||
kanbanAggregateOperationFieldMetadataId?: string | null;
|
||||
|
||||
@ -19,6 +19,9 @@ export type View = {
|
||||
viewFilters: ViewFilter[];
|
||||
viewFilterGroups?: ViewFilterGroup[];
|
||||
viewSorts: ViewSort[];
|
||||
/**
|
||||
* @deprecated Use `viewGroups.fieldMetadataId` instead.
|
||||
*/
|
||||
kanbanFieldMetadataId: string;
|
||||
kanbanAggregateOperation: AGGREGATE_OPERATIONS | null;
|
||||
kanbanAggregateOperationFieldMetadataId: string | null;
|
||||
|
||||
Reference in New Issue
Block a user