From 47d2a0ee61f045acc02cc70121e3fc410e5592f4 Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 25 Jul 2024 10:31:21 +0800 Subject: [PATCH] fix: autoGenId default value should be false when adding collection (#4942) * fix: autoGenId default value should be false when adding collection * fix: test --- .../collection-manager/templates/components/PresetFields.tsx | 4 ++-- .../src/client/__e2e__/collection-template/general2.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/collection-manager/templates/components/PresetFields.tsx b/packages/core/client/src/collection-manager/templates/components/PresetFields.tsx index b54e45556f..49ff139939 100644 --- a/packages/core/client/src/collection-manager/templates/components/PresetFields.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PresetFields.tsx @@ -169,7 +169,7 @@ export const PresetFields = observer( ]; useEffect(() => { const config = { - autoGenId: true, + autoGenId: false, createdAt: true, createdBy: true, updatedAt: true, @@ -209,7 +209,7 @@ export const PresetFields = observer( onChange: (_, selectedRows) => { const fields = getDefaultCollectionFields(selectedRows, form.values); const config = { - autoGenId: !!fields.find((v) => v.name === 'id'), + autoGenId: false, createdAt: !!fields.find((v) => v.name === 'createdAt'), createdBy: !!fields.find((v) => v.name === 'createdBy'), updatedAt: !!fields.find((v) => v.name === 'updatedAt'), diff --git a/packages/plugins/@nocobase/plugin-data-source-main/src/client/__e2e__/collection-template/general2.test.ts b/packages/plugins/@nocobase/plugin-data-source-main/src/client/__e2e__/collection-template/general2.test.ts index 9d1f05f205..29612d242f 100644 --- a/packages/plugins/@nocobase/plugin-data-source-main/src/client/__e2e__/collection-template/general2.test.ts +++ b/packages/plugins/@nocobase/plugin-data-source-main/src/client/__e2e__/collection-template/general2.test.ts @@ -26,7 +26,7 @@ test.describe('create collection with preset fields', () => { const postData = request.postDataJSON(); //默认提交的数据符合预期 expect(postData).toMatchObject({ - autoGenId: true, + autoGenId: false, createdAt: true, createdBy: true, updatedAt: true, @@ -78,7 +78,7 @@ test.describe('create collection with preset fields', () => { const postData = request.postDataJSON(); //提交的数据符合预期 expect(postData).toMatchObject({ - autoGenId: true, + autoGenId: false, createdAt: false, createdBy: false, updatedAt: false,