Skip to content

Commit

Permalink
Merge pull request dozoisch#49 from aij/master
Browse files Browse the repository at this point in the history
Fix race on execute()
  • Loading branch information
dozoisch authored Jun 20, 2017
2 parents 7219e56 + 34bf764 commit 9796adb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/recaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default class ReCAPTCHA extends React.Component {

if (grecaptcha && widgetId !== undefined) {
return grecaptcha.execute(widgetId);
} else {
this._executeRequested = true;
}
}

Expand Down Expand Up @@ -56,6 +58,10 @@ export default class ReCAPTCHA extends React.Component {
widgetId: id,
}, cb);
}
if (this._executeRequested && this.props.grecaptcha && this.state.widgetId !== undefined) {
this._executeRequested = false;
this.execute();
}
}

componentDidMount() {
Expand Down

0 comments on commit 9796adb

Please sign in to comment.