Skip to content

NuxtLink with custom attribute causes vue warning in RC10 #14897

Description

@Andersso

Environment

Nuxi 3.0.0-rc.10
RootDir: /sandbox
Nuxt project info:


  • Operating System: Linux
  • Node Version: v14.19.3
  • Nuxt Version: 3.0.0-rc.10
  • Nitro Version: 0.5.3
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://codesandbox.io/s/jolly-sky-uz9ovm?file=/pages/index.vue

Here's a snippet of the juicy bit:

<NuxtLink v-slot="{ href }" to="/foo" custom>
  <a :href="href">Here's a link</a>
</NuxtLink>

Describe the bug

When using a NuxtLink component with custom attribute, a warning is logged.

Additional context

In RC 8 it was working fine, my suspicion is that the new link prefetching feature is to blame.

Suspicious line of code: https://github.com/nuxt/framework/blob/v3.0.0-rc.10/packages/nuxt/src/app/components/nuxt-link.ts#L229

Maybe worth to mention, a workaround is to use vue router's RouterLink component directly instead of NuxtLink

Logs

[Vue warn]: Extraneous non-props attributes (class) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.

Metadata

Metadata

Assignees

Labels

3.x🐛 bugSomething isn't working as expected

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions