Skip to content

Prevent onDrop from being overridden#52

Open
alukach wants to merge 1 commit into
founderlab:masterfrom
alukach:patch-1
Open

Prevent onDrop from being overridden#52
alukach wants to merge 1 commit into
founderlab:masterfrom
alukach:patch-1

Conversation

@alukach

@alukach alukach commented Feb 5, 2018

Copy link
Copy Markdown

Currently, defining onDrop in props overrides the Dropzone component's onDrop parameter due to the spread props.

I believe that this should fix #46.

@traveled1

Copy link
Copy Markdown

Thanks so much!! Will pull the latest!! :)

@ilyakatz

Copy link
Copy Markdown
Contributor

Just tried it out and works great, would be good to merge it in

@ilyakatz

ilyakatz commented Mar 15, 2018

Copy link
Copy Markdown
Contributor

Actually, if the onDrop is used for validation, what do you think of something like this

    if (!this.props.onDrop || this.props.onDrop(files, rejectedFiles)) {
      new S3Upload(options);
    }

And require onDrop to return true/falsy value?

@alukach

alukach commented Mar 15, 2018

Copy link
Copy Markdown
Author

@ilyakatz can you describe what the advantage would be for this second method?

@ilyakatz

Copy link
Copy Markdown
Contributor

According to this discussion, it looks like creators of the module want to use onDrop for validation. So if validation fails, we should tell react-dropzone-s3-uploder not to upload file into s3

@alukach

alukach commented Mar 16, 2018

Copy link
Copy Markdown
Author

I don't think any change in logic is necessary, this is a tiny bugfix. I believe that, with this fix, the module works as intended.

@ilyakatz

Copy link
Copy Markdown
Contributor

Well, current fix is definitely better than nothing, but it doesn't allow for validation of file prior to upload to S3, which is what it seems onDrop is supposed to do

@alukach

alukach commented Mar 16, 2018 via email

Copy link
Copy Markdown
Author

@alukach

alukach commented Dec 17, 2018

Copy link
Copy Markdown
Author

@founderlab any input on this?

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.

Passing in onDrop prop causes handleDrop to be bypassed

3 participants