Skip to content

Commit 48b4de5

Browse files
committed
fix(VariantManagement): add checking for selectedVariant in showSaveBtn
Fixes SAP#6622
1 parent 799e0dc commit 48b4de5

File tree

1 file changed

+2
-1
lines changed
  • packages/main/src/components/VariantManagement

1 file changed

+2
-1
lines changed

packages/main/src/components/VariantManagement/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ const VariantManagement = forwardRef<HTMLDivElement, VariantManagementPropTypes>
318318
}, [safeChildrenWithFavorites]);
319319

320320
// 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
321-
const showSaveBtn = dirtyState && !Object.prototype.hasOwnProperty.call(selectedVariant, 'readOnly');
321+
const showSaveBtn =
322+
dirtyState && selectedVariant && !Object.prototype.hasOwnProperty.call(selectedVariant, 'readOnly');
322323

323324
return (
324325
<div className={variantManagementClasses} style={style} {...rest} ref={ref}>

0 commit comments

Comments
 (0)