developit / preact-redux

:loop: Preact integration for Redux (no shim needed!)
https://npm.im/preact-redux
MIT License
288 stars 27 forks source link

Don't overwrite passed props to mapDispatchToProps with the default #11

Open oskarhane opened 7 years ago

oskarhane commented 7 years ago

I found an unexpected behavior when defining second argument received by mapDispatchToProps to have a default value. The default value is always passed to it, even though other props are defined on the component.

I created a test to demonstrate it: https://github.com/oskarhane/preact-redux/commit/b0a2b89b54a0061e760575070db15350f115e68c

If the default is removed: let mapDispatchToProps = (d, p = {}) => { to let mapDispatchToProps = (d, p) => { it works as expected.

developit commented 7 years ago

I'm trying to figure out what could cause this, no luck so far.