dkaoster / scrolly-video

Components for scroll-based (or other externally controlled) playback.
https://scrollyvideo.js.org/
MIT License
965 stars 39 forks source link

Constantly destroying ScrollyVideo react component #83

Closed tarsisexistence closed 8 months ago

tarsisexistence commented 8 months ago

Version: 0.0.16 Bundle: react/jsx (both cjs, esm) Repro: https://stackblitz.com/edit/scrolly-video-react-bug

Interesting thing here that you could guess by the title So, I built a reproduction, and if you change there videoPercentage={videoPercentage} for videoPercentage={0} i.e. no video percentage changes on input, but ScrollyVideo still breaks. For the checkbox change (trackScroll), it just blinks, but I think that's fine.

I found that ScrollyVideo stopped breaking just after wrapping it inside of React.memo. From the call stack, I see it finishes with destroy.

So, I can't be sure is videoPercentage really broken because it probably works fine, for example, once per 15-20 times, it doesn't break. In my particular case, I'm interested in videoPercentage API.

tarsisexistence commented 8 months ago

funny thing, if you wrap <App/> in StrictMode (double render on init) it breaks the scroll 🥲

dkaoster commented 8 months ago

@tarsinzer does the recent PR fix this issue? I can close this ticket if so!

tarsisexistence commented 8 months ago

@dkaoster yeah, it does. I can verify that the recent 0.0.17 release is working fine!