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 5b59577610
commit f40f3f92c1

View File

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