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

enhance handleRemove in Upload #5973

Closed
shlice opened this issue May 1, 2017 · 1 comment
Closed

enhance handleRemove in Upload #5973

shlice opened this issue May 1, 2017 · 1 comment

Comments

@shlice
Copy link
Contributor

shlice commented May 1, 2017

What problem does this feature solve?

onRemove will be executed when removing file button is clicked, remove event will be prevented when return value is false.

But, if we want't to popup a confirm dialog, it can't block the execution of onRemove.
So, I add Promise support for onRemove. The return value of onRemove now can be a Promise, and the handleRemove function in Upload can wait for the non-blocking confirm dialog.

What does the proposed API look like?

Example:

onRemove for Upload

onRemove: file => {
    return new Promise((resolve, reject) => {
        confirm({
            title: 'are you sure to remove this file?',
            onOk: () => {
                resolve(true)
            },
        })
    })
}
@lock
Copy link

lock bot commented May 2, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants