Skip to content

Backend Product Edit Page Loads Indefinitely - JavaScript Console Error: Uncaught TypeError: value is null (Firefox Only) #36863

@nikoelgatito

Description

@nikoelgatito

Preconditions and environment

  • Magento Version 2.4.3-p3 (2.4.3+)
  • The Magento_PageBuilder module is installed and enabled.
  • The latest version of the Firefox browser is installed.

Steps to reproduce

  1. Navigate to the backend product edit page using the Firefox browser.

Expected result

The backend product edit page loads normally.

Actual result

The backend product edit page loads indefinitely and the JavaScript error "Uncaught TypeError: value is null" is displayed in the console.

Important Note:
For some reason, this bug is not triggered if the developer tools/console is already open when opening the backend product edit page. In order to reproduce this issue, it is important to first open the backend product edit page and then open the developer console.

Additional information

Cause & Solution:

The issue is caused by the fact that the function passed when adding the 'required-entry' rule does not verify if the value variable is null before using it as an object in the validator-rules-mixin.js file. The error is triggered even if there is an object type verification before trying to access the object's properties, since the type of a null value is object in JavaScript.

File Path:
vendor/magento/module-page-builder/view/adminhtml/web/js/form/element/validator-rules-mixin.js

Simply adding && value !== null is enough to prevent this issue from occurring.

Please refer to the patch below for more details.

Git Diff Patch:

diff --git a/vendor/magento/module-page-builder/view/adminhtml/web/js/form/element/validator-rules-mixin.js b/vendor/magento/module-page-builder/view/adminhtml/web/js/form/element/validator-rules-mixin.js
--- a/vendor/magento/module-page-builder/view/adminhtml/web/js/form/element/validator-rules-mixin.js
+++ b/vendor/magento/module-page-builder/view/adminhtml/web/js/form/element/validator-rules-mixin.js
@@ -234,7 +234,7 @@
                 var allFilled;
 
                 // Validation only for margins and paddings
-                if (typeof value === 'object' && !!(value.padding || value.margin)) {
+                if (typeof value === 'object' && value !== null && !!(value.padding || value.margin)) {
                     allFilled = true;
 
                     _.flatten(_.map(value, _.values)).forEach(function (val) {`

After reviewing the latest version of the validator-rules-mixin.js file, it seems that this issue is still present, as the function still does not verify if the value variable could be null before attempting to access its properties.

Link to the Latest File Version:
https://github.com/magento/magento2-page-builder/blob/47efafdc662272dfea91c4abd1968e63f9aa38df/app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element/validator-rules-mixin.js#L237

Workaround:

Use another browser.

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”.

Metadata

Metadata

Assignees

Labels

Issue: needs updateAdditional information is require, waiting for responseReported on 2.4.3-p3Indicates original Magento version for the Issue report.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions