developit / preact-redux

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

Partially connected component is not updated in 2.1.0 #49

Open Reeywhaar opened 4 years ago

Reeywhaar commented 4 years ago

Hi! Can't wrap my head around simple issue: Given we have a component and and its connected counterpart, the latter is not updated when it receives props.

Made reproducible: https://codesandbox.io/s/sharp-moore-l1gcq

Am I doing something wrong? I've tried all combinations of withRef and pure and still no luck. Also everything works fine in 2.0.3.

Thanks!

kriskuiper commented 4 years ago

Had the same issue 2 days ago (hence the reference of your issue) seems like mapStateToProps is only being called after the first state update (from nothing to something) but not when updating an array, object or string.

I also reverted back to 2.0.3 and now everything works fine...

michaeljsalo commented 4 years ago

I was bit by this bug. Connected component does not rerender when receiving ownProps. Issue is resolved by downgrading preact-redux to 2.0.3. Thanks to @Reeywhaar for a clear demo of this issue.

Bug was experienced with these package versions: Preact 8.5.3 Redux 4.0.4 Preact-Redux 2.1.0