diff --git a/client/commonFramework/update-preview.js b/client/commonFramework/update-preview.js
index e1a68e076d..0f483a6a9c 100644
--- a/client/commonFramework/update-preview.js
+++ b/client/commonFramework/update-preview.js
@@ -9,7 +9,6 @@ window.common = (function(global) {
// context to that of the iframe.
var libraryIncludes = `
`)
- .flatMap(script => {
+ return Observable.combineLatest(
+ iFrameScript$,
+ jQueryScript$,
+ (iframe, jQuery) => ({
+ iframeScript: ``,
+ jQuery: ``
+ })
+ )
+ .first()
+ .flatMap(({ iframeScript, jQuery }) => {
// we make sure to override the last value in the
// subject to false here.
common.previewReady$.onNext(false);
preview.open();
- preview.write(libraryIncludes + code + '' + script);
+ preview.write(
+ libraryIncludes +
+ jQuery +
+ code +
+ '' +
+ iframeScript
+ );
preview.close();
// now we filter false values and wait for the first true
return common.previewReady$