From d390fc2c51b6ac40c55fec30bdb8cb3fe2cb11ca Mon Sep 17 00:00:00 2001 From: Dawid Perdek Date: Sun, 17 Nov 2024 20:35:26 +0100 Subject: [PATCH 1/2] fix(VariantManagement): add checking for selectedVariant in showSaveBtn Fixes #6622 --- packages/main/src/components/VariantManagement/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/main/src/components/VariantManagement/index.tsx b/packages/main/src/components/VariantManagement/index.tsx index 250b1356b89..4da9cd2e909 100644 --- a/packages/main/src/components/VariantManagement/index.tsx +++ b/packages/main/src/components/VariantManagement/index.tsx @@ -318,7 +318,8 @@ const VariantManagement = forwardRef }, [safeChildrenWithFavorites]); // todo: this applies if `readOnly` is set to `false` as well since the value is read via data-attribute and is therefore a string not a boolean - const showSaveBtn = dirtyState && !Object.prototype.hasOwnProperty.call(selectedVariant, 'readOnly'); + const showSaveBtn = + dirtyState && selectedVariant && !Object.prototype.hasOwnProperty.call(selectedVariant, 'readOnly'); return (
From 6263f5ce1fa836771b6605b3e4fd5992f378bb38 Mon Sep 17 00:00:00 2001 From: Dawid Perdek Date: Mon, 18 Nov 2024 17:25:39 +0100 Subject: [PATCH 2/2] fix(VariantManagement): drop hasOwnProperty from selectedVariant.readOnly check Fixes #6617 --- packages/main/src/components/VariantManagement/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/main/src/components/VariantManagement/index.tsx b/packages/main/src/components/VariantManagement/index.tsx index 4da9cd2e909..8b6ccc7bfb7 100644 --- a/packages/main/src/components/VariantManagement/index.tsx +++ b/packages/main/src/components/VariantManagement/index.tsx @@ -317,9 +317,7 @@ const VariantManagement = forwardRef } }, [safeChildrenWithFavorites]); - // todo: this applies if `readOnly` is set to `false` as well since the value is read via data-attribute and is therefore a string not a boolean - const showSaveBtn = - dirtyState && selectedVariant && !Object.prototype.hasOwnProperty.call(selectedVariant, 'readOnly'); + const showSaveBtn = dirtyState && selectedVariant && !selectedVariant.readOnly; return (