From d613f3f559be8229d2b34417a6230c44f80d40bd Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 17 Jul 2017 13:04:30 +0900 Subject: [PATCH] Fix guard against concurrently loading of assets. --- app/assets/javascripts/discourse/lib/load-script.js.es6 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/load-script.js.es6 b/app/assets/javascripts/discourse/lib/load-script.js.es6 index 8baf4b905d8..b82266892cf 100644 --- a/app/assets/javascripts/discourse/lib/load-script.js.es6 +++ b/app/assets/javascripts/discourse/lib/load-script.js.es6 @@ -36,7 +36,8 @@ export default function loadScript(url, opts) { opts = opts || {}; $('script').each((i, tag) => { - _loaded[tag.getAttribute('src')] = true; + const src = tag.getAttribute('src'); + if (src) _loaded[tag.getAttribute('src')] = true; }); @@ -57,12 +58,12 @@ export default function loadScript(url, opts) { }); const cb = function(data) { - _loaded[url] = true; if (opts && opts.css) { $("head").append(""); } done(); resolve(); + _loaded[url] = true; }; let cdnUrl = url;