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

Confirm component show disable buttons when rendering more than once. #3645

Closed
WiXSL opened this issue Sep 3, 2019 · 2 comments
Closed

Confirm component show disable buttons when rendering more than once. #3645

WiXSL opened this issue Sep 3, 2019 · 2 comments

Comments

@WiXSL
Copy link
Contributor

WiXSL commented Sep 3, 2019

Is related to #3241

Example to reproduce it

1.- Check any row in the Posts List.
2.- Click the bulk action button.
3.- Confirm the dialog.
4.- Click the bulk action button again.

The problem is the internal state prop "loading" that is set to true handling confirmation.
Since "loading" is true, after closing the dialog, when you open it again, it disabled the buttons.

As a solution I set it to false and problem solved.

// ...
class Confirm extends Component {
    state = { loading: false };

    handleConfirm = e => {
        e.stopPropagation();
        this.setState({ loading: true }); // <-- Just changing true to false here makes it work.
        this.props.onConfirm();
    };
 // ...
@fzaninotto
Copy link
Member

This never happened to me because whenever a bulk action is confirmed, I unselect all the rows of the datagrid, which unmounts the bulk action button. The next time someone selects a row, the Confirm component mounts again, with an initial loading state of false.

So unless you have a good reason not to unselect all rows after confirming, the problem is on your side.

@fzaninotto
Copy link
Member

fixed by #3647

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

No branches or pull requests

2 participants