fix(nuxt): name anonymous components in render tree (#10011)

This commit is contained in:
Daniel Roe 2023-01-14 01:27:38 +00:00 committed by GitHub
parent 488479ab1b
commit 0db3c6373a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import { appLayoutTransition as defaultLayoutTransition } from '#build/nuxt.conf
// TODO: revert back to defineAsyncComponent when https://github.com/vuejs/core/issues/6638 is resolved
const LayoutLoader = defineComponent({
name: 'LayoutLoader',
inheritAttrs: false,
props: {
name: String,
@ -42,6 +43,7 @@ const LayoutLoader = defineComponent({
}
})
export default defineComponent({
name: 'NuxtLayout',
inheritAttrs: false,
props: {
name: {

View File

@ -2,6 +2,7 @@ import { defineComponent, h } from 'vue'
import type { Component } from 'vue'
const Fragment = defineComponent({
name: 'FragmentWrapper',
setup (_props, { slots }) {
return () => slots.default?.()
}

View File

@ -56,7 +56,7 @@ export default defineComponent({
wrapInKeepAlive(props.keepalive ?? routeProps.route.meta.keepalive ?? (defaultKeepaliveConfig as KeepAliveProps), h(Suspense, {
onPending: () => nuxtApp.callHook('page:start', routeProps.Component),
onResolve: () => { nextTick(() => nuxtApp.callHook('page:finish', routeProps.Component).finally(done)) }
}, { default: () => h(Component, { key, routeProps, pageKey: key, hasTransition } as {}) })
}, { default: () => h(RouteProvider, { key, routeProps, pageKey: key, hasTransition } as {}) })
)).default()
}
})
@ -84,7 +84,8 @@ function _mergeTransitionProps (routeProps: TransitionProps[]): TransitionProps
return defu(..._props)
}
const Component = defineComponent({
const RouteProvider = defineComponent({
name: 'RouteProvider',
// TODO: Type props
// eslint-disable-next-line vue/require-prop-types
props: ['routeProps', 'pageKey', 'hasTransition'],