Skip to content

Commit bf19168

Browse files
authored
Merge pull request #71 from jasonmit/patch-1
Only access instance.getURL if the instance has booted
2 parents 3246281 + 304bd92 commit bf19168

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

lib/ember-app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class EmberApp {
190190
* @param {string} path the URL path to render, like `/photos/1`
191191
* @param {Object} options
192192
* @param {string} [options.html] the HTML document to insert the rendered app into
193-
* @param {ClientRequest}
193+
* @param {ClientRequest}
194194
* @returns {Promise<Result>} result
195195
*/
196196
visit(path, options) {
@@ -218,6 +218,7 @@ class EmberApp {
218218

219219
return instance.boot(bootOptions);
220220
})
221+
.then(() => result.instanceBooted = true)
221222
.then(() => instance.visit(path, bootOptions))
222223
.then(() => waitForApp(instance))
223224
.then(() => createShoebox(doc, fastbootInfo))

lib/result.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const HTMLSerializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap);
99
* method.
1010
*/
1111
class Result {
12-
constructor(options) {
12+
constructor(options) {
13+
this.instanceBooted = false;
1314
this._doc = options.doc;
1415
this._html = options.html;
1516
this._fastbootInfo = options.fastbootInfo;
@@ -70,8 +71,10 @@ class Result {
7071
return this;
7172
}
7273

73-
_finalizeMetadata(instance) {
74-
this.url = instance.getURL();
74+
_finalizeMetadata(instance) {
75+
if (this.instanceBooted) {
76+
this.url = instance.getURL();
77+
}
7578

7679
let response = this._fastbootInfo.response;
7780

0 commit comments

Comments
 (0)