Create many view groups (#15591)

# Introduction
Same as https://github.com/twentyhq/twenty/pull/15576 but for view
groups creation

When creating a kanban view with v2 flag activated in production result
in race condition due to request being slow and //.
That's why we're introducing a batch create on view group here
closing https://github.com/twentyhq/core-team-issues/issues/1847

## In v2
- batch create view group endpoint is available
- frontend will target the new endpoint

## In v1
- batch create view group endpoint is not available
- frontend will stick to old fake batch view group creation loop


## Gallery
### v2
<img width="1796" height="486" alt="image"
src="https://github.com/user-attachments/assets/932cfe9f-85f1-41cc-a1c4-72a4b5d5a256"
/>

### v1
<img width="1852" height="966" alt="image"
src="https://github.com/user-attachments/assets/8aa9df11-cdea-4b12-ae60-118cdf5e257b"
/>
This commit is contained in:
Paul Rastoin
2025-11-04 15:17:55 +01:00
committed by GitHub
parent 558990fbdd
commit 8dd43be9a2
17 changed files with 857 additions and 41 deletions
@@ -204,14 +204,12 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => {
fieldMetadataId: kanbanFieldMetadataId,
} satisfies ViewGroup);
const groupResult = await createViewGroups(
viewGroupsToCreate.map(({ __typename, ...viewGroup }) => ({
input: {
...viewGroup,
viewId: newViewId,
},
const groupResult = await createViewGroups({
inputs: viewGroupsToCreate.map(({ __typename, ...viewGroup }) => ({
...viewGroup,
viewId: newViewId,
})),
);
});
if (groupResult.status === 'failed') {
set(isPersistingViewFieldsState, false);