anthonyshort / deku

Render interfaces using pure functions and virtual DOM
https://github.com/anthonyshort/deku/tree/master/docs
3.41k stars 130 forks source link

State change triggered in `onRemove` method does not get rendered #405

Open kvnneff opened 8 years ago

kvnneff commented 8 years ago

If I dispatch an action inside a component's onRemove method the redux store is updated and deku's render function is called with the store's new state, but what gets rendered is actually a snapshot of the previous state, not the current state.

I created a jsfiddle to demonstrate this: https://jsfiddle.net/5jr3c8Lr/

If you watch the console you'll notice that after clicking the element the handler dispatches an action setting the text to Bar, then the onRemove method dispatches an action setting the text to Baz, however Bar is what appears in the final output.