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

The flow passing twice in dnd plugin creator #9

Closed
antherkiv opened this issue May 31, 2016 · 3 comments
Closed

The flow passing twice in dnd plugin creator #9

antherkiv opened this issue May 31, 2016 · 3 comments

Comments

@antherkiv
Copy link

Hello when I drop an image over the editor, this pass twice in dnd plugin creator, the second time without file and crash, I looking why now.

@bkniffler
Copy link
Owner

Strange, I'm not able to reproduce this. Could you provide an error message or something, that would make it more easy to take care of it!

@antherkiv
Copy link
Author

antherkiv commented Jun 3, 2016

captura de pantalla 2016-06-03 a la s 11 51 15 a m
I found the problem for some reason when the code it's precompiled fails:

draft-js-plugins-dnd-plugin onDropFile onDropInnerFile function,
this piece of code it's the problem:

var data = { files: [], formData: formData };
for (var key in files) {
if (files[key]) {
data.formData.append('files', files[key]);
data.files.push(files[key]);
}

(The example doesn't fails because of that).

Then the function getIndexBy it's attached with files and when the flow it's on readFiles ( because it's not a file readFile function fails and the promise never resolve).

I'm sorry I don't have too much free time.

@bkniffler
Copy link
Owner

Sorry for the extended abscence. I see the problem now, though I still wasn't able to reproduce it. I've added a check:

if (files[key] && files[key] instanceof File)

This should fix the problem for you, but I'm not sure why it gets called 2 times in the first place.

I'm closing this, but if you still got an issue with that, feel free to re-open it!

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