Skip to content

Commit eb34190

Browse files
committed
avoid extra lookup when fastbootInfo reference already exist
since `fastbootInfo` already instantiated and extra `lookup` does not give any value here
1 parent c3a8c83 commit eb34190

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/ember-app.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ class EmberApp {
215215
* the app instance and then visits the given route and destroys the app instance
216216
* when the route is finished its render cycle.
217217
*
218+
* Ember apps can manually defer rendering in FastBoot mode if they're waiting
219+
* on something async the router doesn't know about. This function fetches
220+
* that promise for deferred rendering from the app.
221+
*
218222
* @param {string} path the URL path to render, like `/photos/1`
219223
* @param {Object} fastbootInfo An object holding per request info
220224
* @param {Object} bootOptions An object containing the boot options that are used by
@@ -235,7 +239,7 @@ class EmberApp {
235239
})
236240
.then(() => result.instanceBooted = true)
237241
.then(() => instance.visit(path, bootOptions))
238-
.then(() => waitForApp(instance))
242+
.then(() => fastbootInfo.deferredPromise)
239243
.then(() => instance);
240244
}
241245

@@ -412,16 +416,6 @@ function buildBootOptions(shouldRender) {
412416
};
413417
}
414418

415-
/*
416-
* Ember apps can manually defer rendering in FastBoot mode if they're waiting
417-
* on something async the router doesn't know about. This function fetches
418-
* that promise for deferred rendering from the app.
419-
*/
420-
function waitForApp(instance) {
421-
let fastbootInfo = instance.lookup('info:-fastboot');
422-
return fastbootInfo.deferredPromise;
423-
}
424-
425419
/*
426420
* Writes the shoebox into the DOM for the browser rendered app to consume.
427421
* Uses a script tag with custom type so that the browser will treat as plain

0 commit comments

Comments
 (0)