ErrorPro / react-google-autocomplete

React components for google places API.
MIT License
473 stars 114 forks source link

Same input, different predictions on JSX vs TSX files #172

Closed adrian19hub closed 2 years ago

adrian19hub commented 2 years ago

Hi, I have two files that use the usePlacesService hook, I use the same options on both:

const { placesService, placePredictions, getPlacePredictions } = usePlacesService({
            apiKey: getMapsAPIKey(),
            options: {
                language: 'iw',
                componentRestrictions: { country: 'isr' },
            },
 })`)

Getting predictions on input change:

<Autocomplete
    onInputChange={(evt, newValue) => {               
        getPlacePredictions({ input: newValue });

Displaying the options:

options={placePredictions.map((place) => place.description)}

Input causing issue:

נתב

`Versions: Material (MUI) - 5.7.0 react-google-autocomplete - 2.6.1 react - 17.0.2

Sandbox - https://codesandbox.io/s/elated-jang-q5wjpp

ErrorPro commented 2 years ago

@adrian19hub Hey! I think the issue is that if you paste the term it might be sent in the wrong way. I've checked your sandbox(thanks for providing) and it gave me two results if I pasted the code, but if I later on typed it was giving the same result. What you can do is look at the outgoing XHR to google places api when you do this test: compare the parameters being sent to google in both cases. Let me know the results pls