Skip to content

Commit

Permalink
fix(VariantManagement): add checking for selectedVariant in showSaveBtn
Browse files Browse the repository at this point in the history
Fixes SAP#6622
  • Loading branch information
superdyzio committed Nov 18, 2024
1 parent b5859ed commit d390fc2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/main/src/components/VariantManagement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ const VariantManagement = forwardRef<HTMLDivElement, VariantManagementPropTypes>
}, [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 (
<div className={variantManagementClasses} style={style} {...rest} ref={ref}>
Expand Down

0 comments on commit d390fc2

Please sign in to comment.