Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flux standard action compliance? #5

Open
Qrysto opened this issue Nov 2, 2015 · 11 comments
Open

Flux standard action compliance? #5

Qrysto opened this issue Nov 2, 2015 · 11 comments

Comments

@Qrysto
Copy link

Qrysto commented Nov 2, 2015

What if I want my actions to be FSA-compliant? Some libraries such as redux-promise are best used with FSA, and having an "optimist" property does not work well for me personally.

@ForbesLindesay
Copy link
Owner

Fork this library and write your own? You haven't explained why it doesn't work for you. It's very unclear that FSA is a good idea, or even widely used.

@yched
Copy link

yched commented Nov 26, 2015

FSA is notably used by
https://github.com/acdlite/redux-actions
https://github.com/pauldijou/redux-act
so it is kind of widely used I guess ?

@mwalsher
Copy link

mwalsher commented Feb 1, 2016

+1

@necolas
Copy link

necolas commented Feb 8, 2016

Having the same issue in an app that requires actions to be FSA. It would be nice to be able to configure where the optimist data is added for those of us using FSA to bring some consistency to action shape.

@threepointone
Copy link

You simply have to replace the bit of your redux stack that checks fsa shapes, with one that accepts an optimist key. Here's an example of a redux middleware that does so - https://gist.github.com/threepointone/bef4a28d577707af38b2

@timkindberg
Copy link

Maybe put optimist info into the meta field?

@quicksnap
Copy link

Looking at the code, the optimist reducer factory could be modified to accept a second param, a function mapping the action to the optimist key, and defaulting to action.optimist.

Something like this: master...quicksnap:patch-1

The above is incomplete, but I think it could be made backward-compatible with current API.

I like using FSAs personally, but I haven't found non-FSAs to cause me any trouble. Food for thought if anyone wants to complete the PR.

@ForbesLindesay
Copy link
Owner

@quicksnap I would be willing to accept that approach if completed along with a pull request since it potentially has value beyond FSAs.

@quicksnap
Copy link

Might as well whip it up! Probably won't take too long.

@quicksnap
Copy link

PR #9

@jchook
Copy link

jchook commented Jun 20, 2020

If non-FSA actions break your middleware, I would consider that a bug with your middleware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants