From b6b47995acfb8c1ff5d04a31c14aa75f112a47ab Mon Sep 17 00:00:00 2001 From: Moshe Zemah <35146205+MosheZemah@users.noreply.github.com> Date: Sun, 18 Aug 2019 19:52:11 +0300 Subject: [PATCH] Free resources (free detached nodes from memory) (#1380) * Free resources (free detached nodes from memory) Found an issue when using virtualized list (https://github.com/bvaughn/react-virtualized), where unmounted react components (connected to store using connect) were not collected by the garbage collector. I'm not sure what is the exact explanation here, but it solved my problem. * Fix lint issue * Fix lint issue * Update src/components/connectAdvanced.js Remove comment Co-Authored-By: Tim Dorr --- src/components/connectAdvanced.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/connectAdvanced.js b/src/components/connectAdvanced.js index ccc929a74..e3e6f1da4 100644 --- a/src/components/connectAdvanced.js +++ b/src/components/connectAdvanced.js @@ -368,6 +368,7 @@ export default function connectAdvanced( const unsubscribeWrapper = () => { didUnsubscribe = true subscription.tryUnsubscribe() + subscription.onStateChange = null if (lastThrownError) { // It's possible that we caught an error due to a bad mapState function, but the