Description
Preconditions and environment
- Magento version: Adobe Commerce ver. 2.4.5
When attempting to extend a pagebuilder content type to add in additional functionality, if the content type already has an extension by default to add in the min-height
option on mobile, the js/converter/style/min-height.js
file will error preventing the user from saving the page or block.
This error is caused by the min-height input on mobile having an empty value, which is then returned as undefined by the min-height.js
file.
The return statement in the toDom
function cannot handle an undefined
value.
return value.split(/\+|\-|\*|\//).length > 1 ? "calc(" + (0, _object.get)(data, name) + ")" : value;
Adding a conditional to check if value !== undefined
prevents the error and allows the admin user to save the changes for the page or block.
if(value !== undefined) {
return value.split(/\+|\-|\*|\//).length > 1 ? "calc(" + (0, _object.get)(data, name) + ")" : value;
}
Or adding a conditional to set the value of value
if it's undefined
if(value === undefined) {
value = '100px';
}
This error prevents developers from adding additional functionality to pagebuilder for mobile devices and i believe it also adds to the confusion when it comes to developing for pagebuilder.
Steps to reproduce
- Create an extension for a pagebuilder content type that already has a mobile form. For example, the banner content type or the row. (Confirm it has the
min_height
mobile option). - Attempt to add additional functionality, for example an input or colour selector that if different for both mobile and desktop.
- Once the new functionality has been added, attempt to use it.
- Add a value on Desktop view, switch to mobile and add the mobile value, then attempt to save the page.
- The page wont save and will throw the error -
Cannot read properties of undefined (reading 'split')
Expected result
Extending pagebuilder content types which have the min-height
option should not result in an error preventing the user from saving the page or block.
This prevents developers extending content types for mobile.
Actual result
Attempting to extend pagebuilder content types (which already have a mobile form) to add additional functionality for mobile view results in an error being thrown from min-height.js
and prevents the user from saving the page or block.
Additional information
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Activity