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

thunk completeType not called on fail #568

Open
joelmoss opened this issue Oct 15, 2020 · 5 comments
Open

thunk completeType not called on fail #568

joelmoss opened this issue Oct 15, 2020 · 5 comments

Comments

@joelmoss
Copy link
Contributor

It appears that a failed thunk does not trigger the complete action type.

So a saveTodo thunk should always trigger listeners for saveTodo.type, which it does so for a successful thunk, but not a failed thunk.

@ctrlplusb
Copy link
Owner

Full response in the works. :)

@RobvH
Copy link
Contributor

RobvH commented Oct 16, 2020

With v4+, to trigger the fail action on a failed thunk, you need to call the fail() function, which is passed on the helpers object but was not mentioned in the docs. I have opened two PRs to both add it to the Helpers Typescript type definition as well as document its usage in the api/thunks docs:

#572
#574

@ctrlplusb hope this is helpful! =)

@joelmoss
Copy link
Contributor Author

Yes I know, but the type action still doesn't get called either way. Which it always should, no matter if it succeeded or failed, as it still completed.

@RobvH
Copy link
Contributor

RobvH commented Oct 16, 2020

Apologies, I'm afraid I misread your initial statement. Sean clearly understands, but it might benefit others to have a little more information. Looking from the docs inward, I'm unaware of a type action existing or being expected.

@joelmoss
Copy link
Contributor Author

When I say the type action, I mean the default action. Take a look at https://easy-peasy.now.sh/docs/api/listeners.html#thunkon

...actions => actions.addTodo

Then with thunks, you also have the start, success and fail actions:

...actions => actions.saveTodo.successType

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

No branches or pull requests

3 participants