Closed y310 closed 6 years ago
Hi @y310 Thanks for this.
I'm currently looking at the code and believe that the repeated calls to imagesLoaded
is actually a mistake.
this.imagesLoaded()
should be called once on mounting only, so there should only be a single ref (which will simplify this PR).
I'm sorry to ask, are you interested in submitting another PR once i finish the changes? Otherwise I can do it.
edit: ignore me. Looks like imagesloaded
does not listen for images added after it's been initialised.
Thanks for merging! Yeah, seems like imagesloaded
requires to be called on update as well.
When masonry component is unmounted before finishing all imagesloaded callback, the callback still triggers the bound function. In my case, since I called
setState
in the function, I got a following warning.In order to fix this issue, I added unbinding code to
componentWillUnmount
.