freddy38510 / vue3-lazy-hydration

Lazy Hydration for Vue 3 SSR
MIT License
147 stars 6 forks source link

Move away from internals - use the new native hydrate API #91

Open Tofandel opened 2 months ago

Tofandel commented 2 months ago

Since https://github.com/vuejs/core/pull/11458

Using the component will throw an error __asyncHydrate is not a function (because vue thinks it's a suspense component but the new internal is missing and Vue doesn't explicitly check it)

Since they now provide a native way to do lazy hydration. Maybe this component should be rewritten to be a wrapper around the new api

Tofandel commented 2 months ago

It was patched in 3.5.3 but we'll need to start working on moving away from the internals and to the new API, leaving it open to track this instead

dmitryuk commented 1 week ago

As I faced with a new VUE 3.5 API it doesn't work as I need. Current library doesn't load a lazy chunk before Hydration moment occurred, but VUE 3.5 API does (load). I don't want to load extra JS if I don't need it.

Tofandel commented 1 week ago

Please see https://github.com/nuxt/nuxt/pull/26468

Which will eventually replace this package

dmitryuk commented 1 week ago

I think can't, because with these changes:

  1. Some people don't use NUXT, for example, I'm
  2. As I previously said, async chunk will be loaded immediately on a page load unlike this package do (on hydration event)

lazy load+ lazy hydration versus lazy hydration only (Vue 3.5)

Tofandel commented 1 week ago

This lib is only for lazy hydration, for lazy load of a component you need to do that yourself with a defineAsyncComponent and a dynamic import, a lib cannot do what it doesn't control and in this case it's you already statically importing the component to use it in the slot of the Lazyhydrate component