diff --git a/packages/nuxt/src/app/composables/id.ts b/packages/nuxt/src/app/composables/id.ts index b6e3e69af9..b754aee636 100644 --- a/packages/nuxt/src/app/composables/id.ts +++ b/packages/nuxt/src/app/composables/id.ts @@ -29,6 +29,9 @@ export function useId (key?: string): string { const instanceIndex = key + ':' + instance._nuxtIdIndex[key]++ if (import.meta.server) { + if (import.meta.dev && instance.vnode.type && typeof instance.vnode.type === 'object' && 'inheritAttrs' in instance.vnode.type && instance.vnode.type.inheritAttrs === false) { + console.warn('[nuxt] `useId` is not compatible with components that have `inheritAttrs: false`.') + } const ids = JSON.parse(instance.attrs[ATTR_KEY] as string | undefined || '{}') ids[instanceIndex] = key + ':' + nuxtApp._id++ instance.attrs[ATTR_KEY] = JSON.stringify(ids)