Skip to content

Commit 9796adb

Browse files
authored
Merge pull request #49 from aij/master
Fix race on execute()
2 parents 7219e56 + 34bf764 commit 9796adb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/recaptcha.js

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export default class ReCAPTCHA extends React.Component {
2222

2323
if (grecaptcha && widgetId !== undefined) {
2424
return grecaptcha.execute(widgetId);
25+
} else {
26+
this._executeRequested = true;
2527
}
2628
}
2729

@@ -56,6 +58,10 @@ export default class ReCAPTCHA extends React.Component {
5658
widgetId: id,
5759
}, cb);
5860
}
61+
if (this._executeRequested && this.props.grecaptcha && this.state.widgetId !== undefined) {
62+
this._executeRequested = false;
63+
this.execute();
64+
}
5965
}
6066

6167
componentDidMount() {

0 commit comments

Comments
 (0)