Sync metadata store after view child entity mutations server response (#23150)
## Summary - View persist hooks (`usePerformView(Sort|Field|Filter|Group|FieldGroup|FilterGroup|)APIPersist`) now write successful mutation results back to the metadata store (`addToDraft` / `updateInDraft` / `removeFromDraft` + `applyChanges`), following the existing pattern from `usePerformViewAPIUpdate`. - Previously the store only updated via SSE, so until that landed, save flows diffed against stale view data and re-sent creates with the same id — failing server-side with a duplicate key error. Fixes TWENTY-SERVER-HQM
This commit is contained in:
@@ -207,9 +207,16 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => {
|
||||
id: v4(),
|
||||
}));
|
||||
|
||||
await performViewFilterGroupAPICreate(viewFilterGroupsToCreate, {
|
||||
id: newViewId,
|
||||
});
|
||||
const filterGroupResult = await performViewFilterGroupAPICreate(
|
||||
viewFilterGroupsToCreate,
|
||||
{
|
||||
id: newViewId,
|
||||
},
|
||||
);
|
||||
|
||||
if (filterGroupResult.status === 'failed') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const createViewFilterInputs = viewFiltersToCreate.map(
|
||||
(viewFilter) => ({
|
||||
|
||||
Reference in New Issue
Block a user