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

Convert util functions to async-creators #511

Closed
6 tasks
raineorshine opened this issue Apr 4, 2020 · 1 comment
Closed
6 tasks

Convert util functions to async-creators #511

raineorshine opened this issue Apr 4, 2020 · 1 comment
Assignees
Labels
refactor Refactor without changing behavior

Comments

@raineorshine
Copy link
Contributor

There are a few functions left in util that dispatch actions. They should be converted to action creators. For each one:

  1. git mv src/util/something.js src/action-creators/something.js
  2. export default
  3. Instead of dispatching directly, return the action.
  • e.g. replace dispatch({ type: X, value: Y }) with return ({ type: X, value: Y )}
  • If it dispatches multiple actions, return a thunk, e.g.
    return (dispatch, getState) => { 
      dispatch({ type: X, value: Y )}; 
      dispatch({ type: A, value: B )};
    }
  1. Update import statements and wrap the call sites with dispatch.
@raineorshine raineorshine added the refactor Refactor without changing behavior label Apr 4, 2020
@raineorshine
Copy link
Contributor Author

Fixed in #670

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

No branches or pull requests

3 participants