fix(nuxt): set inheritAttrs: false for fragment components (#28939)

This commit is contained in:
Daniel Roe 2024-09-11 10:26:10 +01:00 committed by GitHub
parent b32bafd386
commit f7efc3d359
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import { defineComponent } from 'vue'
export default defineComponent({ export default defineComponent({
name: 'DevOnly', name: 'DevOnly',
inheritAttrs: false,
setup (_, props) { setup (_, props) {
if (import.meta.dev) { if (import.meta.dev) {
return () => props.slots.default?.() return () => props.slots.default?.()

View File

@ -8,6 +8,7 @@ import { createError } from '../composables/error'
import { islandComponents } from '#build/components.islands.mjs' import { islandComponents } from '#build/components.islands.mjs'
export default defineComponent({ export default defineComponent({
name: 'IslandRenderer',
props: { props: {
context: { context: {
type: Object as () => { name: string, props?: Record<string, any> }, type: Object as () => { name: string, props?: Record<string, any> },

View File

@ -45,6 +45,7 @@ async function loadComponents (source = appBaseURL, paths: NuxtIslandResponse['c
export default defineComponent({ export default defineComponent({
name: 'NuxtIsland', name: 'NuxtIsland',
inheritAttrs: false,
props: { props: {
name: { name: {
type: String, type: String,

View File

@ -18,6 +18,7 @@ export const NuxtTeleportIslandSymbol = Symbol('NuxtTeleportIslandComponent') as
/* @__PURE__ */ /* @__PURE__ */
export default defineComponent({ export default defineComponent({
name: 'NuxtTeleportIslandComponent', name: 'NuxtTeleportIslandComponent',
inheritAttrs: false,
props: { props: {
to: { to: {
type: String, type: String,

View File

@ -9,6 +9,7 @@ import { NuxtTeleportIslandSymbol } from './nuxt-teleport-island-component'
/* @__PURE__ */ /* @__PURE__ */
export default defineComponent({ export default defineComponent({
name: 'NuxtTeleportIslandSlot', name: 'NuxtTeleportIslandSlot',
inheritAttrs: false,
props: { props: {
name: { name: {
type: String, type: String,

View File

@ -7,7 +7,7 @@ import { devRootDir } from '#build/nuxt.config.mjs'
export default (url: string) => defineComponent({ export default (url: string) => defineComponent({
name: 'NuxtTestComponentWrapper', name: 'NuxtTestComponentWrapper',
inheritAttrs: false,
async setup (props, { attrs }) { async setup (props, { attrs }) {
const query = parseQuery(new URL(url, 'http://localhost').search) const query = parseQuery(new URL(url, 'http://localhost').search)
const urlProps = query.props ? destr<Record<string, any>>(query.props as string) : {} const urlProps = query.props ? destr<Record<string, any>>(query.props as string) : {}