Closed simplenotezy closed 4 years ago
This did the trick:
mounted () {
this.$watch(
() => {
return this.$refs.hydrate.hydrated;
},
(val) => {
this.$nextTick(() => {
setTimeout(() => this.initSlider(), 100)
});
}
)
},
Not sure if there is an event you can listen to, when it has been "hydrated". Would be helpful, instead of a watcher.
Please provide a reduced test case.
I tried to, but the codesandbox: https://codesandbox.io/s/fervent-cache-hr8m2 fails for some reason (without making any changes to the default setup), so I guess theres a bug in it atm.
Anyhow, I didn't do any unusual setup. Just used the default Siema setup as can be found in this fiddle: https://codepen.io/pawelgrzybek/pen/qrEXbg
I call "new Siema" on mounted, and then thats when the bug happens. If I call Siema after 1 second, it works.
I'm sorry but I can't provide support for third party libraries. Especially if you can't take the time to create a GitHub repository with a reduced test case so I don't have to spend my time recreating the problem. There are millions of third party libraries out there which might or might not be compatible with this package. I'm not willing to invest my time giving support for free. So I'm closing this.
Hey - it's not a matter of not wanting to provide a reduced test-case, it's a matter of the codesandbox currently not wanting to build, using their untouched&unmodified sandbox template - so it's pretty difficult for me. Also, I don't believe this is related to a third party library. It's directly related to this package - anyhow; I provided a clear working code fix as a work-around to fix the issue. Run the "init" a little bit after the component is hydrated. If you call it on "mounted" it won't work. That should be easy enough to test on your own end, without a dedicated test-case.
Hey - it's not a matter of not wanting to provide a reduced test-case, it's a matter of the codesandbox currently not wanting to build, using their untouched&unmodified sandbox template - so it's pretty difficult for me.
You can create a GitHub repo and provide the steps to build it and how to reproduce the problem, like @bluelovers did for example: https://github.com/maoberlehner/vue-lazy-hydration/issues/24
Open Source does not mean that people have to work for free because of the requirements of other people. Open Source means, that you can use this package, as it is, for free. You can contribute by adding features or fixing bugs yourself. And you can also contribute by finding bugs (like you did).
But if you want that those bugs get fixed you have three options:
If I'm not affected by a bug, and it takes me more than 5 minutes to replicate (or I'm not even sure if it actually is a bug in my software), I won't fix it anytime soon / ever.
I see, thanks for explaining. As I already said, if it takes me more than 15 minutes to replicate an issue (because codesandbox is not working atm), and I have already found a workaround/quickfix, I won't do it anytime soon. At least I make you aware that it has some issues that ought to be looked at, perhaps another guy will report this bug to you at a later stage.
If I wrap around my Siema slider, it is never initialized. The "mounted"-hook (where I init the slider) is fired on page load, perhaps because the slider is close to the top of the page, but it is not initialized.
If I run the method manually, to init the slider, then it works fine.