Skip to content

[Nuxt Island] Components with onServerPrefetch don't render during SSR within nuxt-client #35427

Description

@okdevme

Environment

Snapshot from Stackblitz

Operating system Linux 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
CPU Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (8 cores)
Node.js version v22.22.3
nuxt/cli version 3.36.0
Package manager npm@10.8.2
Nuxt version 4.4.8
Nitro version 2.13.4
Builder vite@7.3.5
Config compatibilityDate, devtools, experimental, modules
Modules @nuxt/icon@2.2.3

Reproduction

https://stackblitz.com/edit/github-7lfrz9wc

Describe the bug

When using selective client rendering within Nuxt Island component (experimental.componentIslands.selectiveClient: true), any component that uses onServerPrefetch inside the tree marked to be hydrated on client side using nuxt-client attribute ends up not being rendered during SSR and causing hydration mismatch errors when hydrating on the client side.

This primarily affects Nuxt Icon, as it uses onServerPrefetch inside its NuxtIconCss

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions