diff --git a/index.js b/index.js index aab2e30cf..2234d48f1 100644 --- a/index.js +++ b/index.js @@ -58,6 +58,7 @@ module.exports = { app.options.fingerprint.generateAssetMap = true; } + app.import('vendor/experimental-render-mode-rehydrate.js'); // get the app registry object and app name so that we can build the fastboot // tree this._appRegistry = app.registry; diff --git a/package.json b/package.json index 4b7849e42..4c588a511 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "ember-cli-lodash-subset": "2.0.1", "ember-cli-preprocess-registry": "^3.1.0", "ember-cli-version-checker": "^2.1.0", - "fastboot": "^1.1.3", + "fastboot": "github:rondale-sc/fastboot#utilize-rehydration-serialization-from-glimmer", "fastboot-express-middleware": "^1.1.0", "fastboot-transform": "^0.1.2", "fs-extra": "^4.0.2", diff --git a/vendor/experimental-render-mode-rehydrate.js b/vendor/experimental-render-mode-rehydrate.js new file mode 100644 index 000000000..91439adc8 --- /dev/null +++ b/vendor/experimental-render-mode-rehydrate.js @@ -0,0 +1,25 @@ +(function() { + if (typeof FastBoot === 'undefined') { + var current = document.getElementById('fastboot-body-start'); + + if (current && current.nextSibling.nodeValue === '%+b:0%') { + Ember.ApplicationInstance.reopen({ + _bootSync: function(options) { + if (options === undefined) { + options = { + _renderMode: 'rehydrate' + }; + } + + return this._super(options); + } + }); + + // Prevent clearRender by removing `fastboot-body-start` which is already + // guarded for + current.parentNode.removeChild(current); + var end = document.getElementById('fastboot-body-end'); + end.parentNode.removeChild(end); + } + } +})();