From e83f379b4900be896e48fcbe6f94222495a4557d Mon Sep 17 00:00:00 2001 From: soupette Date: Tue, 16 Mar 2021 16:11:44 +0100 Subject: [PATCH] Fix ctb mutate when not needed Signed-off-by: soupette --- .../admin/src/utils/mutateCTBContentTypeSchema.js | 2 +- .../src/utils/tests/mutateCTBContentTypeSchema.test.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/strapi-plugin-i18n/admin/src/utils/mutateCTBContentTypeSchema.js b/packages/strapi-plugin-i18n/admin/src/utils/mutateCTBContentTypeSchema.js index 09877447ff..12e3940032 100644 --- a/packages/strapi-plugin-i18n/admin/src/utils/mutateCTBContentTypeSchema.js +++ b/packages/strapi-plugin-i18n/admin/src/utils/mutateCTBContentTypeSchema.js @@ -38,7 +38,7 @@ const mutateCTBContentTypeSchema = (nextSchema, prevSchema) => { } const isNextSchemaLocalized = get(nextSchema, localizedPath, false); - const isPrevSchemaLocalized = get(prevSchema, localizedPath, false); + const isPrevSchemaLocalized = get(prevSchema, ['schema', ...localizedPath], false); // No need to perform modification on the schema, if the i18n feature was not changed // at the ct level diff --git a/packages/strapi-plugin-i18n/admin/src/utils/tests/mutateCTBContentTypeSchema.test.js b/packages/strapi-plugin-i18n/admin/src/utils/tests/mutateCTBContentTypeSchema.test.js index 48a689e154..c30a80761d 100644 --- a/packages/strapi-plugin-i18n/admin/src/utils/tests/mutateCTBContentTypeSchema.test.js +++ b/packages/strapi-plugin-i18n/admin/src/utils/tests/mutateCTBContentTypeSchema.test.js @@ -89,10 +89,12 @@ describe('i18n | utils ', () => { expect( mutateSchema(ctSchema, { - pluginOptions: { - pluginA: { foo: 'bar' }, - i18n: { localized: true }, - pluginB: { foo: 'bar' }, + schema: { + pluginOptions: { + pluginA: { foo: 'bar' }, + i18n: { localized: true }, + pluginB: { foo: 'bar' }, + }, }, }) ).toEqual(ctSchema);