vue-lazy-hydration icon indicating copy to clipboard operation
vue-lazy-hydration copied to clipboard

`this.$refs.hydrate.hydrated` not possible in version 2?

Open simplenotezy opened this issue 3 years ago • 4 comments

In version one you could do:

<LazyHydrate ref="hydrate" when-visible>

And then in your javascript method do like so:

if (this.$refs.hydrate.hydrated) {

However, in version 2 that seems not to be possible anymore.

Am I missing something? I didn't find a changelog from version 1 -> 2 so not sure what has changed.

simplenotezy avatar Nov 18 '20 15:11 simplenotezy

Because I've completely rewritten v2, this is not possible anymore. I did not consider this a breaking change because your approach relies on implementation details that were not meant to be public and were not in the documentation. I could add it back in. However, I'd prefer not to, to keep the code as simple as possible.

I also don't recommend doing this. The Vue model is props down, events up.

Would it be useful to you if <LazyHydrate> emits an event at the moment of hydration?

<LazyHydrate @hydrate="isHydrated = true">

maoberlehner avatar Nov 18 '20 16:11 maoberlehner

Yes, that would be very helpful @maoberlehner

simplenotezy avatar Nov 19 '20 15:11 simplenotezy

This certainly broke certain things in production. The events suggestion would certainly fix this. I'll keep an older version running for now. +1

mattickx avatar Dec 13 '20 17:12 mattickx

I might be missing something, but this is an essential feature for lazy loading components to work for example (and to not have all of them "preloaded" on page load). And event would work fine, though.

mastercoding avatar Feb 07 '21 09:02 mastercoding