feat: NoValue is bot properly created the backend (#9110)

`No Value` view groups wasn't properly created when we select a group by
field metadata, this PR fix the issue.
Also a script is added to backfill the current view groups.

---------

Co-authored-by: Marie <51697796+ijreilly@users.noreply.github.com>
This commit is contained in:
Jérémy M
2024-12-18 12:26:38 +01:00
committed by GitHub
parent d895468ebe
commit 3b48920314
7 changed files with 178 additions and 53 deletions

View File

@ -73,6 +73,20 @@ export const useHandleRecordGroupField = ({
}) satisfies ViewGroup,
);
if (
!existingGroupKeys.has(`${fieldMetadataItem.id}:`) &&
fieldMetadataItem.isNullable === true
) {
viewGroupsToCreate.push({
__typename: 'ViewGroup',
id: v4(),
fieldValue: '',
isVisible: true,
position: fieldMetadataItem.options.length,
fieldMetadataId: fieldMetadataItem.id,
} satisfies ViewGroup);
}
const viewGroupsToDelete = view.viewGroups.filter(
(group) => group.fieldMetadataId !== fieldMetadataItem.id,
);