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 )