fix(renderer): retry render if renderer is in loading or created state (#5417)

This commit is contained in:
Pooya Parsa 2019-03-30 23:35:15 +04:30 committed by GitHub
parent 001ba775fa
commit 8b9969599d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -452,11 +452,15 @@ export default class VueRenderer {
}
}
async renderRoute(url, context = {}) {
async renderRoute(url, context = {}, _retried) {
/* istanbul ignore if */
if (!this.isReady) {
// Production
if (!this.context.options.dev) {
if (!_retried && ['loading', 'created'].includes(this._state)) {
await this.ready()
return this.renderRoute(url, context, true)
}
switch (this._state) {
case 'created':
throw new Error('Renderer ready() is not called! Please ensure `nuxt.ready()` is called and awaited.')