Fix creation of a new view duplicating existing filters (#9240)
Fixes #9239
This commit is contained in:
@ -13,6 +13,7 @@ import { useDestroyOneRecordMutation } from '@/object-record/hooks/useDestroyOne
|
||||
import { useUpdateOneRecordMutation } from '@/object-record/hooks/useUpdateOneRecordMutation';
|
||||
import { GraphQLView } from '@/views/types/GraphQLView';
|
||||
import { ViewFilter } from '@/views/types/ViewFilter';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
export const usePersistViewFilterRecords = () => {
|
||||
const { objectMetadataItem } = useObjectMetadataItem({
|
||||
@ -49,7 +50,7 @@ export const usePersistViewFilterRecords = () => {
|
||||
mutation: createOneRecordMutation,
|
||||
variables: {
|
||||
input: {
|
||||
id: viewFilter.id,
|
||||
id: v4(),
|
||||
fieldMetadataId: viewFilter.fieldMetadataId,
|
||||
viewId: view.id,
|
||||
value: viewFilter.value,
|
||||
|
||||
@ -17,6 +17,7 @@ import {
|
||||
TimeoutError,
|
||||
UserInputError,
|
||||
} from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
|
||||
import { isDefined } from 'src/utils/is-defined';
|
||||
|
||||
export const workspaceQueryRunnerGraphqlApiExceptionHandler = (
|
||||
error: Error,
|
||||
@ -49,7 +50,11 @@ export const workspaceQueryRunnerGraphqlApiExceptionHandler = (
|
||||
return fieldMetadata?.label;
|
||||
});
|
||||
|
||||
const columnNames = affectedColumns?.join(', ');
|
||||
if (!isDefined(affectedColumns)) {
|
||||
throw new UserInputError(`A duplicate entry was detected`);
|
||||
}
|
||||
|
||||
const columnNames = affectedColumns.join(', ');
|
||||
|
||||
if (affectedColumns?.length === 1) {
|
||||
throw new UserInputError(
|
||||
|
||||
Reference in New Issue
Block a user