fix: await buildDone hook (#4955)

This commit is contained in:
Xin Du (Clark) 2019-02-05 09:53:47 +00:00 committed by Pooya Parsa
parent 5c053f5cb0
commit 5c08db20b4

View File

@ -22,7 +22,7 @@ export default ({ options, nuxt, renderRoute, resources }) => async function nux
} = result
if (redirected) {
nuxt.callHook('render:routeDone', url, result, context)
await nuxt.callHook('render:routeDone', url, result, context)
return html
}
if (error) {
@ -35,7 +35,7 @@ export default ({ options, nuxt, renderRoute, resources }) => async function nux
if (fresh(req.headers, { etag })) {
res.statusCode = 304
res.end()
nuxt.callHook('render:routeDone', url, result, context)
await nuxt.callHook('render:routeDone', url, result, context)
return
}
res.setHeader('ETag', etag)
@ -74,7 +74,7 @@ export default ({ options, nuxt, renderRoute, resources }) => async function nux
res.setHeader('Accept-Ranges', 'none') // #3870
res.setHeader('Content-Length', Buffer.byteLength(html))
res.end(html, 'utf8')
nuxt.callHook('render:routeDone', url, result, context)
await nuxt.callHook('render:routeDone', url, result, context)
return html
} catch (err) {
/* istanbul ignore if */