## Only nitpicks Method signature mutation from several to one record arg Renamed a variable in map to fit related business logic #10014 Followup
This commit is contained in:
@ -94,7 +94,7 @@ export const useHandleRecordGroupField = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (viewGroupsToCreate.length > 0) {
|
if (viewGroupsToCreate.length > 0) {
|
||||||
await createViewGroupRecords(viewGroupsToCreate, view);
|
await createViewGroupRecords({ viewGroupsToCreate, viewId: view.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewGroupsToDelete.length > 0) {
|
if (viewGroupsToDelete.length > 0) {
|
||||||
|
|||||||
@ -25,11 +25,11 @@ export const computeOptimisticRecordFromInput = ({
|
|||||||
objectMetadataItems,
|
objectMetadataItems,
|
||||||
}: ComputeOptimisticCacheRecordInputArgs) => {
|
}: ComputeOptimisticCacheRecordInputArgs) => {
|
||||||
const unknownRecordInputFields = Object.keys(recordInput).filter(
|
const unknownRecordInputFields = Object.keys(recordInput).filter(
|
||||||
(fieldName) => {
|
(recordKey) => {
|
||||||
const isUnknownMetadataItemField =
|
const isUnknownMetadataItemField =
|
||||||
objectMetadataItem.fields.find(({ name }) => name === fieldName) ===
|
objectMetadataItem.fields.find((field) => field.name === recordKey) ===
|
||||||
undefined;
|
undefined;
|
||||||
const isTypenameField = fieldName === OBJECT_RECORD_TYPENAME_KEY;
|
const isTypenameField = recordKey === OBJECT_RECORD_TYPENAME_KEY;
|
||||||
return isUnknownMetadataItemField && !isTypenameField;
|
return isUnknownMetadataItemField && !isTypenameField;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -4,10 +4,13 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
|
|||||||
import { useCreateManyRecords } from '@/object-record/hooks/useCreateManyRecords';
|
import { useCreateManyRecords } from '@/object-record/hooks/useCreateManyRecords';
|
||||||
import { useDestroyManyRecords } from '@/object-record/hooks/useDestroyManyRecords';
|
import { useDestroyManyRecords } from '@/object-record/hooks/useDestroyManyRecords';
|
||||||
import { useUpdateOneRecordMutation } from '@/object-record/hooks/useUpdateOneRecordMutation';
|
import { useUpdateOneRecordMutation } from '@/object-record/hooks/useUpdateOneRecordMutation';
|
||||||
import { GraphQLView } from '@/views/types/GraphQLView';
|
|
||||||
import { ViewGroup } from '@/views/types/ViewGroup';
|
import { ViewGroup } from '@/views/types/ViewGroup';
|
||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
|
|
||||||
|
type CreateViewGroupRecordsArgs = {
|
||||||
|
viewGroupsToCreate: ViewGroup[];
|
||||||
|
viewId: string;
|
||||||
|
};
|
||||||
export const usePersistViewGroupRecords = () => {
|
export const usePersistViewGroupRecords = () => {
|
||||||
const apolloClient = useApolloClient();
|
const apolloClient = useApolloClient();
|
||||||
|
|
||||||
@ -25,13 +28,13 @@ export const usePersistViewGroupRecords = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const createViewGroupRecords = useCallback(
|
const createViewGroupRecords = useCallback(
|
||||||
(viewGroupsToCreate: ViewGroup[], view: GraphQLView) => {
|
({ viewGroupsToCreate, viewId }: CreateViewGroupRecordsArgs) => {
|
||||||
if (viewGroupsToCreate.length === 0) return;
|
if (viewGroupsToCreate.length === 0) return;
|
||||||
|
|
||||||
return createManyRecords(
|
return createManyRecords(
|
||||||
viewGroupsToCreate.map((viewGroup) => ({
|
viewGroupsToCreate.map((viewGroup) => ({
|
||||||
...viewGroup,
|
...viewGroup,
|
||||||
viewId: view.id,
|
viewId,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -146,7 +146,10 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => {
|
|||||||
fieldMetadataId: kanbanFieldMetadataId,
|
fieldMetadataId: kanbanFieldMetadataId,
|
||||||
} satisfies ViewGroup);
|
} satisfies ViewGroup);
|
||||||
|
|
||||||
await createViewGroupRecords(viewGroupsToCreate, newView);
|
await createViewGroupRecords({
|
||||||
|
viewGroupsToCreate,
|
||||||
|
viewId: newView.id,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldCopyFiltersAndSortsAndAggregate === true) {
|
if (shouldCopyFiltersAndSortsAndAggregate === true) {
|
||||||
|
|||||||
@ -128,7 +128,7 @@ export const useSaveCurrentViewGroups = (viewBarComponentId?: string) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
createViewGroupRecords(viewGroupsToCreate, view),
|
createViewGroupRecords({ viewGroupsToCreate, viewId: view.id }),
|
||||||
updateViewGroupRecords(viewGroupsToUpdate),
|
updateViewGroupRecords(viewGroupsToUpdate),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user