From 5a5b73dcfa411c508ebb2d5e32ad84fe5832878e Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 8 Jun 2018 15:48:35 -0400 Subject: [PATCH] Load xblock resources into studio *before* the corresponding xblock html --- cms/static/js/views/xblock.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cms/static/js/views/xblock.js b/cms/static/js/views/xblock.js index b37c3f6399..cc8bb7e95e 100644 --- a/cms/static/js/views/xblock.js +++ b/cms/static/js/views/xblock.js @@ -125,7 +125,8 @@ define(['jquery', 'underscore', 'common/js/components/utils/view_utils', 'js/vie */ renderXBlockFragment: function(fragment, element) { var html = fragment.html, - resources = fragment.resources; + resources = fragment.resources, + blockView = this; if (!element) { element = this.$el; } @@ -135,8 +136,9 @@ define(['jquery', 'underscore', 'common/js/components/utils/view_utils', 'js/vie // by included scripts are logged to the console but are then ignored assuming // that at least the rendered HTML will be in place. try { - this.updateHtml(element, html); - return this.addXBlockFragmentResources(resources); + return this.addXBlockFragmentResources(resources).done(function() { + blockView.updateHtml(element, html); + }); } catch (e) { console.error(e, e.stack); return $.Deferred().resolve();