typeful-redux icon indicating copy to clipboard operation
typeful-redux copied to clipboard

Add way to map actions to multiple reducers

Open paulkoerbitz opened this issue 8 years ago • 3 comments

This was brought up in a discussion on reddit. Right now typeful-redux does not offer the possibility to react in multiple reducers to a dispatched action. This is indeed a bit of a limitation.

paulkoerbitz avatar Mar 08 '18 21:03 paulkoerbitz

Perhaps a third argument to the reducer function for options, one of which can relay to take the action type as is.

('clear', s => [])

could be written as

('someOtherStore/someActionType', s => {...}, { preserveActionType: true })

Which would then just take the action type as is instead of concatenating it with the given store. It's possible more options may be useful in the future, and this doesn't really change the normal flow of the current api at all.

jaredpetker avatar Mar 10 '18 22:03 jaredpetker

@jaredpetker I've opend up a new issue #3 for this as I think it is a slightly different topic from the problem this issue addresses.

Can you describe your use case for this? I'm not sure I fully understand the end goal of this yet.

(Let's please move this discussion to issue #3).

paulkoerbitz avatar Mar 11 '18 19:03 paulkoerbitz

Yea, indeed, my initial thought does not handle this at all (don't know what I was thinking looking back at it). I don't have a separate use case at the moment other than what this issue presents. Will ponder this some more as being able to handle actions dispatched from other stores is something I would need for our use case as well (even if only used very sparingly).

jaredpetker avatar Mar 11 '18 19:03 jaredpetker