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
fix: call setState before callbacks #690
Conversation
Codecov Report
@@ Coverage Diff @@
## master #690 +/- ##
=======================================
Coverage 99.11% 99.11%
=======================================
Files 3 3
Lines 226 226
Branches 68 68
=======================================
Hits 224 224
Misses 2 2
Continue to review full report at Codecov.
|
src/index.js
Outdated
// Update `acceptedFiles` and `rejectedFiles` state | ||
// This will make children render functions receive the appropriate | ||
// values | ||
this.setState({ acceptedFiles, rejectedFiles }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this still does not have any guarantee that the cb fn will be called after the state is set (.setState()
is async).
What you want is to have the onDrop* cb fns called in the .setState({...}, () => /* call the onDrop* fns here */)
cb fn 😄
Also, add a test for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, rebase your branch as there are some conflicts that prevent us from merging.
Ugh, wrong button. |
🎉 This PR is included in version 6.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What kind of change does this PR introduce?
Did you add tests for your changes?
If relevant, did you update the documentation?
Summary
A potential fix for: #689
Does this PR introduce a breaking change?
Nope
Other information