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.

"You have included the Google Maps JavaScript API multiple times on this page"

See original GitHub issue

I’m getting this error in the console when using this component: You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors. And sometimes (not all the time - sometimes it works fine but still throws the above warning) when I type in a place name in the rendered component, the dropdown is stuck at “Loading…”.

image

I did have another Google Maps related fetch that I thought was causing the warning but I’ve removed that to see if it might solve the issue but no dice.

Here’s my import

import GooglePlacesAutocomplete from 'react-google-places-autocomplete';

And here’s a stripped down version of how I’m calling the component

const NewHorse = props => {
  const [location, setLocation] = useState({});
  const [places, setPlaces] = useState([]);

  const setLocationState = data => {
    setLocation({
      id: data.id,
      description: data.description
    });
  }

  const GetLocation = () => {
    if (places.length > 0) {
      // return a select element with places
      console.log(places);
      // return <Select className="horse-form-select horse-form-input places" options={places} defaultValue={places[0]} onChange={onPlacesChange} />
    } else {
      return <GooglePlacesAutocomplete onSelect={setLocationState} apiKey={props.firebaseAPIKey} placeholder="Enter a city or zip code" autocompletionRequest={{types: ["(regions)"]}} />
    }
  }

  return (
    <Form className="horse-form">
      <div className="horse-form-container">
        {/* Location */}
        <Label className="horse-form-label" for="location">Location</Label>
        <div className="location">
          {/* <MdLocationSearching fill="white" className="location-icon" onClick={getLocation} /> */}
          <GetLocation />
        </div>
      </div>
    </Form>
  )
}

Any help is greatly appreciated.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Tintefcommented, May 21, 2020

@cwinters8 Thanks again for reporting this!

A new fixed version 2.0.6 is already published 😄

1reaction
cwinters8commented, May 14, 2020

Cool! Also, thanks very much for the great library. It’s super handy and has already saved me a lot of headaches.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"You have included the Google Maps API multiple times on ...
I'm getting the error "You have included the Google Maps API multiple times on this page. This may cause unexpected errors." I know...
Read more >
You have included the Google Maps JavaScript API multiple ...
Got a problem with this You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors...
Read more >
You have included the Google Maps API multiple times on this ...
If two or more plugins (or theme) load the Google Maps API, and the library is loaded twice, a javascript error will occur...
Read more >
Fix: Google Maps JavaScript API Multiple Times On This Page ...
An error can be shown in the console when you are using JavaScript API multiple times on your page, that says: "You have...
Read more >
You have included the Google Maps API multiple times on this ...
Hi there, Need help to debug: "You have included the Google Maps API multiple times on this page. This may cause unexpected errors....
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