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