-
Notifications
You must be signed in to change notification settings - Fork 28
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
redux-resource-action-creators #250
Conversation
00c5498
to
3a22d03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do a more thorough review soon; just did a quick pass at some of the build-related stuff. Thanks for putting this together @sprjr – looks like a great start!
"types", | ||
"type", | ||
"checking" | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some of these should be removed since they refer to prop types
"type", | ||
"checking" | ||
], | ||
"author": "James Smith <[email protected]>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should prob be you @sprjr ✌️
var env = process.env.NODE_ENV; | ||
var config = { | ||
format: 'umd', | ||
moduleName: 'ReduxResourcePropTypes', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReduxResourceActionCreators
var config = { | ||
format: 'umd', | ||
moduleName: 'ReduxResourcePropTypes', | ||
external: ['redux-resource', 'prop-types'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'prop-types'
isn't needed here
moduleName: 'ReduxResourcePropTypes', | ||
external: ['redux-resource', 'prop-types'], | ||
globals: { | ||
'prop-types': 'PropTypes', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line can be removed
expect(createActionCreators).to.be.a('function'); | ||
}); | ||
|
||
describe(' - Creating Action Creators', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's drop the " – "
prefix for these nested describes
3a22d03
to
80226b9
Compare
Was chatting today about the current API here with @jmeas. Here is what we do right now:
The last two methods have a different API right now, although they are for different reasons.
We talked about changing the APIs to one of these, although we're open to more suggestions:
Which would retain the 'make sure you pass some resources for any of your actions' , although they are not necessarily required for these in all cases (e.g. you could just have a Another suggestion was:
Both of these would allow a consistent API across all 4 methods, although they have different tradeoffs or gains I would imagine. Any thoughts? /cc @vinodkl @marlonpp @tbranyen |
@sprjr , I thought a bit about this while doing #275 / #277 . I'm currently thinking that the API should be: // Create a set of action creators. `actionDefaults` will be set on every action.
var actionCreators = new createActionCreators('read', actionDefaults);
// Send off the `pending` action. Add/override `actionDefaults` with `action`.
actionCreators.pending(action);
actionCreators.failed(action);
actionCreators.succeeded(action);
actionCreators.null(action); I think there are two benefits to using this API:
My concern with the different signatures in the current implementation is that it may be too much for folks to remember. |
80226b9
to
d806730
Compare
This update changes the action creator utilities to the discussed API signature in #250 in which each method simply calls '.pending(action)' to produce a redux-resource action.
c164d9a
to
0c2ff39
Compare
This update changes the action creator utilities to the discussed API signature in #250 in which each method simply calls '.pending(action)' to produce a redux-resource action.
460f808
to
05b5c38
Compare
05b5c38
to
8aef204
Compare
Implements the discussion and API in #186 that can be leveraged in both plugins & applications using
redux-resource
to help create valid action shapes for our ecosystem.Published:
[email protected]
so we can try it out in apps and take a look at how this API works in practice after the bikeshedding that produced it ;)