Eliminate invalid callbacks to onChange prop #51
Description
In this example usage, I upload 2 files, one of which is 2.7MB and the other is 4.2MB. Notice that the onChange
prop is called back multiple times. The first time it is called back, only the first uploaded file is provided in the arguments, the second time it is called back, both files are provided in the arguments, etc.
You can see evidence of this in the console output of the example above
onChange called back with files: [File(2744170)]
onChange called back with files: (2) [File(2744170), File(4199232)]
Similarly, if 3 files are uploaded, onChange
is called back 3 times with 1, 2, and 3 files respectively.
We should instead callback to onChange
only once, providing all successfully processed files in the arguments.
I'm pretty sure that this bug was introduced recently, probably during the last month or two. The performance on the demo website is much better. My guess is that the demo site is using an older version of the component that does not include this bug.