fix(nuxt): don't call renderMeta if it is not defined (#6201)

* fix(nuxt): don't call renderMeta if it is not defined

* fix: check for nuxt existence as well
This commit is contained in:
Daniel Roe 2022-07-28 14:11:47 +01:00 committed by GitHub
parent 4e2667fcb7
commit 748b063afa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,9 +146,9 @@ export default eventHandler(async (event) => {
}
// Render meta
const renderedMeta = await ssrContext.renderMeta()
const renderedMeta = await ssrContext.renderMeta?.() ?? {}
// Create render conrtext
// Create render context
const rendered: NuxtRenderContext = {
ssrContext,
html: {
@ -178,7 +178,7 @@ export default eventHandler(async (event) => {
// Allow hooking into the rendered result
const nitroApp = useNitroApp()
await ssrContext.nuxt.hooks.callHook('app:rendered', rendered)
await ssrContext.nuxt?.hooks.callHook('app:rendered', rendered)
await nitroApp.hooks.callHook('nuxt:app:rendered', rendered)
// Construct HTML response