simpler bundleRenderer check

This commit is contained in:
Pooya Parsa 2017-06-14 22:12:20 +04:30
parent 59f8e48549
commit e2ee016a22

View File

@ -231,18 +231,10 @@ export default class Renderer extends Tapable {
} }
} }
async renderRoute (url, context = {}, ctr = 0) { async renderRoute (url, context = {}) {
/* istanbul ignore if */ /* istanbul ignore if */
if (!this.bundleRenderer || !this.resources.appTemplate) { if (!this.bundleRenderer || !this.resources.appTemplate) {
if (ctr > 5) { return Promise.reject(new Error('bundleRenderer is not available'))
// Don't wait more than 5 seconds
return Promise.reject(new Error('bundleRenderer is not ready'))
}
return new Promise((resolve) => {
setTimeout(() => {
resolve(this.renderRoute(url, context, ctr++))
}, 1000)
})
} }
// Log rendered url // Log rendered url