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 #6622
  • Loading branch information
superdyzio committed Nov 17, 2024
1 parent 799e0dc commit 48b4de5
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 48b4de5

Please sign in to comment.