From 07a54e93039593b9f66769951f6aa34d044528e8 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Tue, 4 Aug 2020 09:39:34 +0300 Subject: [PATCH] Wait for initialization to complete --- src/scripts/site.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scripts/site.js b/src/scripts/site.js index ab8e17971d..cd85c35e83 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -615,6 +615,7 @@ function initClient() { } var localApiClient; + let promise; (function () { var urlArgs = 'v=' + (window.dashboardVersion || new Date().getDate()); @@ -696,7 +697,7 @@ function initClient() { onError: onRequireJsError }); - require(['fetch']) + promise = require(['fetch']) .then(() => require(['jQuery', 'polyfill', 'fast-text-encoding', 'intersection-observer', 'classlist-polyfill', 'css!assets/css/site', 'jellyfin-noto'], (jQuery) => { // Expose jQuery globally window.$ = jQuery; @@ -1107,7 +1108,7 @@ function initClient() { }); })(); - return onWebComponentsReady(); + promise.then(onWebComponentsReady); } initClient();