question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

requestOptions seems to get ignored

See original GitHub issue

Bug Report

Describe the Bug

passing the requestOptions doesn’t seem to work. Looking at the google doc https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest it should be possible to restrict results from an specific country by passing the property componentRestrictions.country with the country code. found here https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#ComponentRestrictions

I’m pretty new with react so maybe this isn’t bug but maybe I have done something wrong in my code.

How to Reproduce

inside requestOptions, simply put

componentRestrictions: {
      country: 'sv'
   }

CodeSandbox Link

https://codesandbox.io/s/useplacesautocomplete-x-reach-ui-forked-qo84h in the same demo as you already have. Look at line 25 in this forked sandbox

Expected Behavior

I expect this code to only show results from the country SV (sweden)

componentRestrictions: {
      country: 'sv'
   }

Your Environment

  • Device: [e.g. MacBook Pro, iPhone12]
  • OS: [Windows]
  • Browser: [Chrome]
  • Version: [88.0]

I really like this! Except from this it works grate in my app! If this is not a bug, I would really appreciate help to get it to work !

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
imprex92commented, Feb 3, 2021

@wellyshen Hello again! Thank you! clearing the data cache along with componentRestrictions: { country: 'se' } worked like a charm! for some reason the gecoding feature is returning “cannot read lat of undefined” now instead haha. I will see if I can find out the problem…

Thanks again for your help!

1reaction
wellyshencommented, Feb 3, 2021

@imprex92 Nice keep going man.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request options get ignored / overwritten · Issue #31 - GitHub
Looking in the console, it seems that the content type of 'application/x-www-form-urlencoded' is set for the GET request but not for the POST...
Read more >
Why is an OPTIONS request sent and can I disable it?
Yes it's possible to avoid options request. Options request is a preflight request when you send (post) any data to another domain.
Read more >
Solved: FeatureLayer.historicMoment is ignored when applie...
I just ran a very simple test and seems like historic moments are being honored. In this example, I am starting with a...
Read more >
HTML5 Document Viewer - The host option is ignored after ...
HTML 5 Document Viewer - A client-side Integration approach stopped working and the host URL passed to the requestOptions.
Read more >
Execution of Stored Procedure seems to ignore passed in ...
I've been getting up to speed with Store Procedures with Cosmos DB and I've found that when I execute a sp i wrote...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found