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

Add onSuccess and onFailure properties to DeleteButton #5310

Merged
merged 2 commits into from
Oct 1, 2020

Conversation

gavacho
Copy link

@gavacho gavacho commented Sep 27, 2020

Fixes #5309
Fixes #4219

I don't see how to test the <DeleteWithUndoButton onFailure={onFailure} /> use-case.

Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

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

Excellent! Looking forward to merging this one.

onSuccess: () => {
setOpen(false);
if (onSuccess === undefined) {
onSuccess = () => {
Copy link
Member

Choose a reason for hiding this comment

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

you should not change a parameter passed to the hook. Prefer inlining the test for the onSuccess inside the useDelete call.

@fzaninotto fzaninotto merged commit e84c924 into marmelab:next Oct 1, 2020
@fzaninotto
Copy link
Member

Thanks!

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.

2 participants