2

In magento 2 Suddenly i got this error on product-> catalog -> relevant product . And round circle keep sniping in console I got this

select.js:67 Uncaught TypeError: data.some is not a function
at findFirst (select.js:67)
    at UiClass.clear (select.js:285)
    at UiClass.setInitialValue (select.js:299)
    at UiClass.setInitialValue (wrapper.js:109)
    at UiClass.initialize (abstract.js:70)
    at UiClass.initialize (wrapper.js:109)
    at UiClass._super (wrapper.js:106)
    at UiClass.initialize (select.js:119)
    at UiClass.initialize (wrapper.js:109)
    at new UiClass (class.js:49)
4

Were you able to resolve this? In case you weren't-- and in case you're using composer-- here are the steps to fix it:

In your composer.json:

-Require Composer Patches in the "require" section:

"cweagans/composer-patches": "^1.6"

In "extras":

"patches": {
      "magento/module-ui": {
          "some.data is not a function": "patches/module-ui-patch-1.diff"
      }
 }

Then create web/patches/module-ui-patch-1.diff:

diff --git a/view/base/web/js/form/element/select.js 
b/view/base/web/js/form/element/select.js
index 0c266b9..22fe498 100644
--- a/view/base/web/js/form/element/select.js
+++ b/view/base/web/js/form/element/select.js
@@ -64,16 +64,17 @@ define([
 function findFirst(data) {
     var value;

-        data.some(function (node) {
-            value = node.value;
-
-            if (Array.isArray(value)) {
-                value = findFirst(value);
-            }
+        if (data instanceof Array) {
+            data.some(function (node) {
+                value = node.value;

-            return !_.isUndefined(value);
-        });
+                if (Array.isArray(value)) {
+                    value = findFirst(value);
+                }

+                return !_.isUndefined(value);
+            });
+        }
          return value;
 }
  • can explain little bit in detail, i am also facing same issue, i modified the composer.json, but how to add patch to js file? Where do i need to move the patch, – jafar pinjar Nov 28 '18 at 10:08
  • Hey @jafarpinjar , did you create the patches folder in your installation route with the above diff file inside of it? – brackfost Nov 28 '18 at 15:54
3

In {base_url}/files/html/vendor/magento/module-ui/view/base/web/js/form/element/select.js

from

        data.some(function (node) {
            value = node.value;

            if (Array.isArray(value)) {
                value = findFirst(value);
            }

            return !_.isUndefined(value);
});

to

       data = _.some(data, function (node) {
            value = node.value;
            if (Array.isArray(value)) {
                value = findFirst(value);
            }

            return !_.isUndefined(value);
 });
  • Is it worked for you?@Rama Chandran – jafar pinjar Nov 28 '18 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.