{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/10358","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/10358/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/10358/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/10358/events","html_url":"https://github.com/yiisoft/yii2/issues/10358","id":121220749,"number":10358,"title":"Race condition in yii.js's script filter","user":{"login":"nkovacs","id":2269242,"avatar_url":"https://avatars.githubusercontent.com/u/2269242?v=3","gravatar_id":"","url":"https://api.github.com/users/nkovacs","html_url":"https://github.com/nkovacs","followers_url":"https://api.github.com/users/nkovacs/followers","following_url":"https://api.github.com/users/nkovacs/following{/other_user}","gists_url":"https://api.github.com/users/nkovacs/gists{/gist_id}","starred_url":"https://api.github.com/users/nkovacs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkovacs/subscriptions","organizations_url":"https://api.github.com/users/nkovacs/orgs","repos_url":"https://api.github.com/users/nkovacs/repos","events_url":"https://api.github.com/users/nkovacs/events{/privacy}","received_events_url":"https://api.github.com/users/nkovacs/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/complexity:medium","name":"complexity:medium","color":"bfdadc"},{"url":"https://api.github.com/repos/yiisoft/yii2/labels/severity:normal","name":"severity:normal","color":"d7e102"},{"url":"https://api.github.com/repos/yiisoft/yii2/labels/type:enhancement","name":"type:enhancement","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/yiisoft/yii2/milestones/16","html_url":"https://github.com/yiisoft/yii2/milestones/2.0.8","labels_url":"https://api.github.com/repos/yiisoft/yii2/milestones/16/labels","id":1242959,"number":16,"title":"2.0.8","description":"","creator":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":0,"state":"open","created_at":"2015-08-05T22:18:21Z","updated_at":"2015-12-09T12:02:38Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-12-09T11:58:16Z","updated_at":"2015-12-09T13:32:23Z","closed_at":null,"body":"The script filter in yii.js which prevents loading the same script twice has a race condition.\r\nWhen a script file is first loaded, the ajax request is allowed to go through, and the script is added to loadedScripts. If the same script file is requested again while the first request is still loading, it will immediately be aborted. However, the script is not yet loaded, so subsequent scripts that might depend on this file will fail.\r\n\r\nThis does not cause a problem with $.html and friends, because they use synchronous ajax to load the scripts. However, this is deprecated, and will hopefully be fixed in jquery 3.0: https://github.com/jquery/jquery/issues/1895. Pjax also does it asynchronously: https://github.com/yiisoft/jquery-pjax/commit/7a47df7b36d1031fbd576929e040ebab588b207b\r\n\r\nSo e.g. loading two pjax partials which both have an activeform (and thus need yii.activeform.js)  at the same time will cause the second one to break, because the inline script will execute before yii.activeform.js is loaded (assuming the base page didn't load yii.activeform.js).\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/163233339","html_url":"https://github.com/yiisoft/yii2/issues/10358#issuecomment-163233339","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/10358","id":163233339,"user":{"login":"SilverFire","id":4499203,"avatar_url":"https://avatars.githubusercontent.com/u/4499203?v=3","gravatar_id":"","url":"https://api.github.com/users/SilverFire","html_url":"https://github.com/SilverFire","followers_url":"https://api.github.com/users/SilverFire/followers","following_url":"https://api.github.com/users/SilverFire/following{/other_user}","gists_url":"https://api.github.com/users/SilverFire/gists{/gist_id}","starred_url":"https://api.github.com/users/SilverFire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SilverFire/subscriptions","organizations_url":"https://api.github.com/users/SilverFire/orgs","repos_url":"https://api.github.com/users/SilverFire/repos","events_url":"https://api.github.com/users/SilverFire/events{/privacy}","received_events_url":"https://api.github.com/users/SilverFire/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T13:32:23Z","updated_at":"2015-12-09T13:32:23Z","body":"Now it's clear for me, thank you very much for the detailed explanation.\r\n\r\nWould you like to deal with it and make a PR? :)"}}