pauldijou / redux-act

An opinionated lib to create actions and reducers for Redux
Apache License 2.0
1.49k stars 60 forks source link

Issue using assignTo with multiple functions? #27

Closed deanrad closed 8 years ago

deanrad commented 8 years ago

I had a great idea for binding the actions functions to both a store, and another function to send the payloadedAction over a websocket. But experimenting with it, I had to wonder if this functionality works as intended, or if I'm using it wrong?

// in an Actions file
assignAll(Actions, [console.log.bind(console, 'Foo: '), store])

//when an action is triggered, our logger fires
Foo:  Object {type: "SET_STATE", payload: "SET_STATE", meta: Object}

// but the action has been dispatched (or reduced) in a weird way
store.getState()
Object {0: "S", 1: "E", 2: "T", 3: "_", 4: "S", 5: "T", 6: "A", 7: "T", 8: "E", game: Object, players: Array[0], round: Object}

Full source is here: https://github.com/deanius/react-trivia/tree/bindActionIssue

deanrad commented 8 years ago

Closed because I worked around it by using a single function.