kenwheeler / mcfly

Flux architecture made easy
BSD 3-Clause "New" or "Revised" License
762 stars 46 forks source link

maxListeners #47

Open gillesdemey opened 9 years ago

gillesdemey commented 9 years ago

Hi,

I was having an issue where node was complaining about a potential memory leak because too many listeners were being added for the same event.

I saw that this was fixed in Biff (https://github.com/FormidableLabs/biff/commit/04edf8acab28c3e035a52905e312b7e7f4f3870d) but not in this repo.

Is there a particular reason for that? Could we apply the same fix here?

tomatau commented 9 years ago

You can setMaxlisteners directly onto the store object yourself to prevent the error bubbling:

MyStore.setMaxlisteners(0);

but I'm not sure why we keep the default max listeners on stores, I guess it's quite useful to catch memory leaks from components not being unmounted or being unmounted incorrectly

kenwheeler commented 9 years ago

The fix will find its way back here, I've just been swamped at my full time.

gillesdemey commented 9 years ago

I should have pointed out that I already fixed it the way that @tomatau described it.

But now I'm second-guessing the way I've structured my components, instead of having every GridItem listen to a Store, I should probably have the GridView listen to it and propagate the changes to the items via a property?

Anyhow, I can whip up a PR for the Store if you want.