[BREAKING_CHANGE_VIEW_SORT] Refactor view sort to v2 (#17609)

Fixes https://github.com/twentyhq/core-team-issues/issues/2187

---------

Co-authored-by: prastoin <paul@twenty.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
BOHEUS
2026-03-04 12:48:58 +00:00
committed by GitHub
parent 906a0aed38
commit c97d872b9f
135 changed files with 3262 additions and 815 deletions
@@ -197,7 +197,7 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => {
});
const viewSortsToCreate = currentRecordSorts
.map((recordSort) => mapRecordSortToViewSort(recordSort, newViewId))
.map((recordSort) => mapRecordSortToViewSort(recordSort))
.map((viewSort) => ({
...viewSort,
id: v4(),
@@ -230,7 +230,20 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => {
return undefined;
}
await performViewSortAPICreate(viewSortsToCreate, { id: newViewId });
const createViewSortInputs = viewSortsToCreate.map((viewSort) => ({
input: {
id: viewSort.id,
fieldMetadataId: viewSort.fieldMetadataId,
viewId: newViewId,
direction: viewSort.direction,
},
}));
const sortResult = await performViewSortAPICreate(createViewSortInputs);
if (sortResult.status === 'failed') {
return undefined;
}
}
await refreshCoreViewsByObjectMetadataId(objectMetadataItem.id);