You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this issue one supposed strategy to bind action creators to selectedState is to use mergeProps, which seems a good idea as opposed to passing state to mapDispatch for the reasons mentioned in the issue. But when using mergeProps to achieve this, i defeat any memoizers that try to return the same objects, because as mergeProps will always be called, it will always return new bound functions. As far as I can tell, mergeProps does not have the possibility of a factory method as mapState and mapDispatch have.
I currently try to workaround this problem by adding the memoizer in my dumb component, updating in the constructor and in componentWillUpdate()
Are there any reasons against this addition?
Or is it such an edge case that we do not even want the few lines of code, we need to add for that, and the little time this would additionally need on the creation of the component.
If this is the case, I feel like we should add a proposal on how to work around this somewhere (or just generally have a few about memoization and binding action creators).
And would the current workaround I use be valid here, or am I missing something there?
The text was updated successfully, but these errors were encountered:
PR #488 was to address this but it was written against the wrong branch. I think it would be a good feature to have, if someone wants to reimplement it against the next branch. The test from #488 is probably still usable though.
FWIW I created a library for doing memoized deep merging, but never got around to using it (I used a custom connect function instead). It anyone would like to use it, it can be found here: https://github.com/frankwallis/remerger.
In this issue one supposed strategy to bind action creators to selectedState is to use mergeProps, which seems a good idea as opposed to passing state to mapDispatch for the reasons mentioned in the issue. But when using mergeProps to achieve this, i defeat any memoizers that try to return the same objects, because as mergeProps will always be called, it will always return new bound functions. As far as I can tell, mergeProps does not have the possibility of a factory method as mapState and mapDispatch have.
I currently try to workaround this problem by adding the memoizer in my dumb component, updating in the constructor and in componentWillUpdate()
Are there any reasons against this addition?
Or is it such an edge case that we do not even want the few lines of code, we need to add for that, and the little time this would additionally need on the creation of the component.
If this is the case, I feel like we should add a proposal on how to work around this somewhere (or just generally have a few about memoization and binding action creators).
And would the current workaround I use be valid here, or am I missing something there?
The text was updated successfully, but these errors were encountered: