-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[Geolocation] Fix getCurrentPosition #4764
Conversation
By analyzing the blame information on this pull request, we identified @nicklockwood, @brentvatne and @zjj010104 to be potential reviewers. |
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
@@ -234,6 +233,7 @@ - (void)timeout:(NSTimer *)timer | |||
selector:@selector(timeout:) | |||
userInfo:request | |||
repeats:NO]; | |||
_pendingRequests = [NSMutableArray new]; |
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.
I think this needs to be
if (!_pendingRequests) {
_pendingRequests = [NSMutableArray new];
}
Otherwise you're wiping out all previous requests each time you call getCurrentPosition().
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.
@nicklockwood
Considered that, but it seemed like getCurrentPosition() was the only place that actually adds anything to the pendingRequests so I figured it wasn't necessary. Guess it doesn't hurt either way.
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.
It is the only thing that adds to it, but what if you call getCurrentPosition() again before the first request returns?
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.
Good call...updated!
@marcshilling updated the pull request. |
… it doesn't already exist)
Squashed commits |
@facebook-github-bot shipit |
Thanks for updating @marcshilling and congrats on your first RN PR! |
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/560069157482654/int_phab to review. |
1 similar comment
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/560069157482654/int_phab to review. |
Thanks all so much! |
Instantiates the _pendingRequests array before trying to add to it. As it currently stands, we try to add the pending request before the array is created. getCurrentPosition always fails on the first try.