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

notifSend() returns a function not an action object. #29

Open
jcheroske opened this issue Jul 9, 2016 · 5 comments
Open

notifSend() returns a function not an action object. #29

jcheroske opened this issue Jul 9, 2016 · 5 comments

Comments

@jcheroske
Copy link

The documentation shows the usage as:

dispatch(notifSend(message));

which seems to indicate that notifSend is returning an action object, but it actually returns a thunk. This is problematic for two reasons:

  • It assumes that everyone is using redux-thunk or similar middleware
  • It makes it much less natural to use with redux-saga

I feel that notifSend should return a simple action object, or another function should be added to the api the does just that.

@jcheroske
Copy link
Author

Just learned you can't use backticks in the title. Good to know.

@kylecesmat
Copy link
Collaborator

Feel free to submit a PR for this! I agree that it shouldn't assume the application is using thunks.

@mpint
Copy link

mpint commented Aug 14, 2016

@jcheroske, what is the workaround you found if you're using redux saga?

@simutis
Copy link

simutis commented Feb 7, 2018

If you are not using thunks you can instead of:

dispatch(
   notifSend({
       message: 'Message success',
       kind: 'info',
       dismissAfter: 2000
   })
 );

do:

notifSend({
   message: 'Message success',
   kind: 'info',
   dismissAfter: 2000
})(dispatch);

@janosh
Copy link

janosh commented May 17, 2018

@simutis Thanks, that worked great!

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

No branches or pull requests

5 participants