fix cloning of a field

This commit is contained in:
Nitwel
2020-10-20 17:14:02 +02:00
parent 3f387eb471
commit adf5b593b0

View File

@@ -207,6 +207,7 @@ import { getInterfaces } from '@/interfaces';
import router from '@/router';
import notify from '@/utils/notify';
import { i18n } from '@/lang';
import { cloneDeep } from 'lodash';
import { getLocalTypeForField } from '../../get-local-type';
export default defineComponent({
@@ -323,8 +324,8 @@ export default defineComponent({
};
async function saveDuplicate() {
const newField: any = {
...props.field,
const newField: Record<string, any> = {
...cloneDeep(props.field),
field: duplicateName.value,
collection: duplicateTo.value,
};
@@ -334,6 +335,10 @@ export default defineComponent({
delete newField.meta.sort;
}
if (newField.schema) {
delete newField.schema.comment;
}
delete newField.name;
duplicating.value = true;