2.6.6 release not compatible with `unmountIfInvisible` prop
We are using react-lazyload to only mount a resource-heavy component only when it's visible. The unmountIfInvisible option is ideal for that and previously worked perfectly.
As of the latest release this has broken. It will now intermittently mount and unmount while scrolling.
While I'm not overly familiar with your codebase, it seems the ref will always point to the one for the placeholder. In 2.6.5, this would refer to either the placeholder or the loaded component depending on which is visible. I think it might be causing it to unmount early as the visibility check then returns false.
@MattCrouch thanks for raising this, I will have a look
I have similar behavior as what @MattCrouch said. It seems to cause unexpected render. And I revert to version 2.6.5 to solve the problem。 Please review this problem ASAP. Thank you very much.
https://codesandbox.io/s/react-lazyload-bug-bf1mx
My problem is when first loading everything seems going well, but any tiny scroll will cause the parent component stops to passing props to children.
@evilucifero thanks for sharing, will looking into it as first thing
@ameerthehacker Because the impact is relatively large, I rolled back the code to 2.6.7
@twobin thank you very much. It seems to work fine right now.
@twobin thanks, will try to find the root of the problem and may be release the fix as beta first as this one seems to be tricky
@MattCrouch @evilucifero @twobin I have made a fix for this and have release a beta version, the updated codesandbox is here
https://codesandbox.io/s/summer-tree-8z7k2
try it out as
npm i react-lazyload@beta
let me know if everything is working fine, then I will cut a stable release. I will probably create a spectrum channel to discuss similar release plans in the feature
@ameerthehacker I've tried out the beta version and everything's working great.
Thanks for sorting it out so quickly. Much appreciated!
@evilucifero waiting for your response for a stable release