fix: no template data requested during depulicating (#2240)

* fix: depulicate failed

* fix: depulicate failed to load template data
This commit is contained in:
katherinehhh 2023-07-13 14:12:17 +08:00 committed by GitHub
parent 5638a2fa2b
commit 11d127e3a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,16 +41,16 @@ export const DuplicateAction = observer((props: any) => {
const { name } = useCollection(); const { name } = useCollection();
const { getCollectionFields } = useCollectionManager(); const { getCollectionFields } = useCollectionManager();
const { t } = useTranslation(); const { t } = useTranslation();
const collectionFields = getCollectionFields(__collection); const collectionFields = getCollectionFields(__collection || name);
const template = { const template = {
key: 'duplicate', key: 'duplicate',
dataId: id, dataId: id,
default: true, default: true,
fields: fields:
duplicateFields?.filter((v) => { duplicateFields?.filter((v) => {
return collectionFields.find((k) => k.name === v); return collectionFields.find((k) => v.includes(k.name));
}) || [], }) || [],
collection: __collection, collection: __collection || name,
}; };
const isLinkBtn = fieldSchema['x-component'] === 'Action.Link'; const isLinkBtn = fieldSchema['x-component'] === 'Action.Link';
const handelQuickDuplicate = async () => { const handelQuickDuplicate = async () => {