joaogranado / react-updater

Functional stateful components made easy
9 stars 1 forks source link

Update cache to use Weakmap instead of Map #7

Closed joaogranado closed 7 years ago

joaogranado commented 7 years ago

This updates the cache objects to use Weakmap instead of Map in order to prevent potential memory leaks. Maps treat the objects used for keys as a new reference, if the original reference was deleted there would be the reference in the key which would not be garbage collected. Using a Weakmap this reference would be garbage collected when the original reference is removed.