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

Migrating action creators to Redux saga #77

Merged
merged 37 commits into from
May 23, 2016
Merged

Migrating action creators to Redux saga #77

merged 37 commits into from
May 23, 2016

Conversation

n1k0
Copy link
Contributor

@n1k0 n1k0 commented May 21, 2016

This patch leverages redux-saga and moved the action creators logic to dedicated sagas. Actions are now just simple synchronous descriptors, and sagas handle the asynchronous request stuff, triggering actions to notify the reducers when they're processed.

That makes the codebase better organized and easier to read especially because of the use of generators.

While the diff is large and seems to add more code than before, this is mostly because we now have much more granular tests for action creators.

The patch has been deployed to gh-pages.

Todo

  • Write missing saga tests
  • Figure out why we need babel-polyfill even for browsers that support generators natively

@@ -21,7 +21,7 @@ export default class CollectionEdit extends Component {

render() {
const {collection} = this.props;
const {label, schema, uiSchema, displayFields, busy} = collection;
const {schema={}, uiSchema={}, displayFields=[], label, busy} = collection;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wao, I didn't know about that syntax :) neat !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me neither 2 days ago :p Now I see so many places this should be used it's embarrassing.

@n1k0 n1k0 changed the title [Experiment] Migrating action creators to Redux saga Migrating action creators to Redux saga May 23, 2016
@n1k0
Copy link
Contributor Author

n1k0 commented May 23, 2016

This is now ready for, ahem, review. I'm pretty sure no one on Earth will ever want to thoroughly review this, so I'm gonna let it sit for a few hours and land it if I don't get any feedback meanwhile.

Pinging @Natim @leplatrem @glasserc @almet

@Natim
Copy link
Member

Natim commented May 23, 2016

I will have a look at it :)


let client;

export function setupClient({server, username, password}) {
Copy link
Member

@Natim Natim May 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we shouldn't pass the authorization header directly to later support other authorization methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, but please let's iterate here :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok 👍

@Natim
Copy link
Member

Natim commented May 23, 2016

There is tests 👍

@Natim
Copy link
Member

Natim commented May 23, 2016

I read the code, it looks good to me.

@n1k0
Copy link
Contributor Author

n1k0 commented May 23, 2016

I'm landing this.

@n1k0 n1k0 merged commit cf0ed90 into master May 23, 2016
@n1k0 n1k0 deleted the redux-saga branch May 23, 2016 14:50
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

Successfully merging this pull request may close these issues.

None yet

3 participants