fix(gatsby-image): fix memory leak and use more appropriate data structures for cache and listeners#10278
fix(gatsby-image): fix memory leak and use more appropriate data structures for cache and listeners#10278wardpeet merged 16 commits intogatsbyjs:masterfrom alexandernanberg:refactor/gatsby-image-listeners
Conversation
…ctures for cache and listeners
|
Hmm can someone re-run the circleci e2e test? Can't reproduce it locally 🤔 |
|
I did rerun, but it still happened - didn't code yet, but maybe it's not false negative if it happened 2 times in a row? |
|
Yeah I had forgotten to change the |
wardpeet
left a comment
There was a problem hiding this comment.
This one looks good to me. Thanks for fixing this one. Memory leaks are hard to catch 👍
I added a few nitpicks 🙈
|
I might need to give this another proper look after I merged master into this again, there were some issues that I thought the tests would've picked up 🤔 |
Could you elaborate which tests? And mabye add them ^^ |
wardpeet
left a comment
There was a problem hiding this comment.
I removed the createRef part as it's a breaking change, we will revisit this when we want to publish gatsby v3
…ctures for cache and listeners (gatsbyjs#10278) * fix(gatsby-image): fix memory leak and use more appropriate data structures for cache and listeners * fix(gatsby-image): remove from listeners when unmounting * fix(gatsby-image): fix ref reference for fixed images * nits * Revert propType changes * Fix issues after merge * Fix cache bug after merge * set -> add * Cleanup observer on unmount * remove → delete * remove refs Co-authored-by: Ward Peeters <ward@coding-tech.com>
SetandMapinstead of objects and arrays.listenerswhen element is no longer observed (was probably a memory leak before, since we pushed items to the array with out ever removing them?).componentDidMountinstead of in the refHandler.componentWillUnmount.