Fix "Save As Copy" to include existing values of relational items (#22028)

This commit is contained in:
Pascal Jufer
2024-04-10 16:44:43 +02:00
committed by GitHub
parent 990d4d8e0b
commit bf9b95a5c3
2 changed files with 8 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
"@directus/app": patch
---
Fixed "Save As Copy" functionality to include existing values of relational items

View File

@@ -11,13 +11,13 @@ import { translate } from '@/utils/translate-object-values';
import { unexpectedError } from '@/utils/unexpected-error';
import { validateItem } from '@/utils/validate-item';
import { useCollection } from '@directus/composables';
import { isSystemCollection } from '@directus/system-data';
import { Field, Query, Relation } from '@directus/types';
import { getEndpoint } from '@directus/utils';
import { AxiosResponse } from 'axios';
import { mergeWith } from 'lodash';
import { ComputedRef, MaybeRef, Ref, computed, isRef, ref, unref, watch } from 'vue';
import { UsablePermissions, usePermissions } from './use-permissions';
import { getEndpoint } from '@directus/utils';
import { isSystemCollection } from '@directus/system-data';
type UsableItem<T extends Record<string, any>> = {
edits: Ref<Record<string, any>>;
@@ -337,7 +337,7 @@ export function useItem<T extends Record<string, any>>(
for (const col of columns) {
const colName = col.split('.')[1];
if (colName !== undefined) {
if (colName && colName in updatedItem) {
item[colName] = updatedItem[colName];
}
}