From d72316490db49ad13bd175bbceaecef9f71ce420 Mon Sep 17 00:00:00 2001 From: Fernando Marichal Date: Tue, 19 Sep 2023 13:31:32 -0300 Subject: [PATCH] Fix error displaying block after removing variation (#40255) * Fix error displaying block after removing variation * Disable Add button * Add changelog --- ...x-40165_error_displaying_block_when_removing_variation | 4 ++++ .../components/attribute-control/new-attribute-modal.tsx | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 packages/js/product-editor/changelog/fix-40165_error_displaying_block_when_removing_variation diff --git a/packages/js/product-editor/changelog/fix-40165_error_displaying_block_when_removing_variation b/packages/js/product-editor/changelog/fix-40165_error_displaying_block_when_removing_variation new file mode 100644 index 00000000000..737adebd6d0 --- /dev/null +++ b/packages/js/product-editor/changelog/fix-40165_error_displaying_block_when_removing_variation @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +Fix error displaying block after removing variation #40255 diff --git a/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.tsx b/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.tsx index b35d583b532..05e4af3c73a 100644 --- a/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.tsx +++ b/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.tsx @@ -403,7 +403,9 @@ export const NewAttributeModal: React.FC< NewAttributeModalProps > = ( { } value={ attribute === - null + null || + attribute === + undefined ? [] : attribute.terms } @@ -506,7 +508,9 @@ export const NewAttributeModal: React.FC< NewAttributeModalProps > = ( { label={ addAccessibleLabel } disabled={ values.attributes.length === 1 && - values.attributes[ 0 ] === null + ( values.attributes[ 0 ] === null || + values.attributes[ 0 ] === + undefined ) } onClick={ () => onAddingAttributes( values )