Skip to content

JS is eagerly loaded for lazy hydrated components #12969

Open
@danielroe

Description

@danielroe

Vue version

3.5.13

Link to minimal reproduction

https://stackblitz.com/edit/github-kozduzwy?file=src/App.vue,src/components/HelloWorld.vue,src/entry-client.ts,src/entry-server.ts,index.html&terminal=dev

Steps to reproduce

Load the site. Click the button to confirm the component is not hydrated.

Open the network tab and see that the JS code has been loaded by the async component.

What is expected?

defineAsyncComponent should not immediately load the JS for a component if there is a custom hydration strategy

What is actually happening?

defineAsyncComponent immediately triggers loading of JS chunk, regardless of hydration strategy being present

System Info

Any additional comments?

Context: implementing lazy hydration in Nuxt: nuxt/nuxt#26468.

I've shipped a temporary workaround involving double layer of wrapping defineAsyncComponent but ideally defineAsyncComponent should wait to load the component until hydrate is called, if there is a custom hydration strategy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions