{"action":"created","issue":{"url":"https://api.github.com/repos/bem/bem-core/issues/1446","repository_url":"https://api.github.com/repos/bem/bem-core","labels_url":"https://api.github.com/repos/bem/bem-core/issues/1446/labels{/name}","comments_url":"https://api.github.com/repos/bem/bem-core/issues/1446/comments","events_url":"https://api.github.com/repos/bem/bem-core/issues/1446/events","html_url":"https://github.com/bem/bem-core/issues/1446","id":188297071,"number":1446,"title":"Проблема с переопределением modules.define","user":{"login":"doochik","id":31961,"avatar_url":"https://avatars.githubusercontent.com/u/31961?v=3","gravatar_id":"","url":"https://api.github.com/users/doochik","html_url":"https://github.com/doochik","followers_url":"https://api.github.com/users/doochik/followers","following_url":"https://api.github.com/users/doochik/following{/other_user}","gists_url":"https://api.github.com/users/doochik/gists{/gist_id}","starred_url":"https://api.github.com/users/doochik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doochik/subscriptions","organizations_url":"https://api.github.com/users/doochik/orgs","repos_url":"https://api.github.com/users/doochik/repos","events_url":"https://api.github.com/users/doochik/events{/privacy}","received_events_url":"https://api.github.com/users/doochik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-09T16:52:19Z","updated_at":"2016-11-10T05:58:07Z","closed_at":null,"body":"Наткнулся на проблему из-за вот этого места https://github.com/bem/bem-core/blob/v3/common.blocks/i-bem/__dom/i-bem__dom.js#L1563\r\n\r\nКаждый блок делает define `i-bem__dom_init`, соответственно при резолве получается большая рекурсия и большой стек. В моем проекте от этого пострадал живой пользователь и ферма автотестов. Firefox'ы в определенном окружении (win/linux) падают с 'too much recursion'\r\n\r\nХочется отсюда рекурсию убрать. Пока запатчил вот так (да, storedDeps некрасиво передается по ссылке)\r\n```js\r\n(function() {\r\n\r\nvar origDefine = modules.define;\r\nvar storedDeps = [];\r\nvar iBemDomInitDefined = false;\r\n\r\nmodules.define = function(name, deps, decl) {\r\n    origDefine.apply(modules, arguments);\r\n\r\n    if (name !== 'i-bem__dom_init' && arguments.length > 2 && ~deps.indexOf('i-bem__dom')) {\r\n        storedDeps.push(name);\r\n        if (!iBemDomInitDefined) {\r\n            iBemDomInitDefined = true;\r\n            modules.define('i-bem__dom_init', storedDeps, function(provide, _, prev) {\r\n                provide(prev);\r\n            });\r\n        }\r\n\r\n    }\r\n};\r\n\r\n})();\r\n```\r\n\r\nЕсть идеи как это исправить? @narqo @dfilatov "},"comment":{"url":"https://api.github.com/repos/bem/bem-core/issues/comments/259608156","html_url":"https://github.com/bem/bem-core/issues/1446#issuecomment-259608156","issue_url":"https://api.github.com/repos/bem/bem-core/issues/1446","id":259608156,"user":{"login":"dfilatov","id":67957,"avatar_url":"https://avatars.githubusercontent.com/u/67957?v=3","gravatar_id":"","url":"https://api.github.com/users/dfilatov","html_url":"https://github.com/dfilatov","followers_url":"https://api.github.com/users/dfilatov/followers","following_url":"https://api.github.com/users/dfilatov/following{/other_user}","gists_url":"https://api.github.com/users/dfilatov/gists{/gist_id}","starred_url":"https://api.github.com/users/dfilatov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfilatov/subscriptions","organizations_url":"https://api.github.com/users/dfilatov/orgs","repos_url":"https://api.github.com/users/dfilatov/repos","events_url":"https://api.github.com/users/dfilatov/events{/privacy}","received_events_url":"https://api.github.com/users/dfilatov/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T05:58:07Z","updated_at":"2016-11-10T05:58:07Z","body":"@doochik А на какой глубине рекурсии это проявляется?"}}
{"actor":{"display_login":"dfilatov"}}