Skip to content

Commit

Permalink
Free resources (free detached nodes from memory) (#1380)
Browse files Browse the repository at this point in the history
* 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 <timdorr@users.noreply.github.com>
  • Loading branch information
2 people authored and markerikson committed Aug 18, 2019
1 parent 4b9cece commit b6b4799
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/components/connectAdvanced.js
Expand Up @@ -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
Expand Down

0 comments on commit b6b4799

Please sign in to comment.