Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): name anonymous components in render tree (#10011)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jan 14, 2023
1 parent 488479a commit 0db3c63
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/nuxt/src/app/components/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -42,6 +43,7 @@ const LayoutLoader = defineComponent({
}
})
export default defineComponent({
name: 'NuxtLayout',
inheritAttrs: false,
props: {
name: {
Expand Down
1 change: 1 addition & 0 deletions packages/nuxt/src/app/components/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?.()
}
Expand Down
5 changes: 3 additions & 2 deletions packages/nuxt/src/pages/runtime/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
})
Expand Down Expand Up @@ -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'],
Expand Down

0 comments on commit 0db3c63

Please sign in to comment.