Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Application route for delaying loading until components have finished.
export default class ApplicationRoute extends Route {
model(params, transition) {
if (this.fastboot && this.fastboot.isFastBoot) {
let promise = new Promise((resolve, reject) => {
let poll = () => {
later(() => {
if (this.finder.inFlightRequests.length === 0 && this.query.inFlightQueriesCount === 0) {
scheduleOnce("afterRender", this, resolve)
return
} else {
poll()
}
}, 50)
}
poll()
})
this.fastboot.deferRendering(promise)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.