Skip to content

v1.1.0 Not adding libraries (drawing/places etc) to maps api object #673

Closed

Description

@tim-soft

Upgrading from v1.0.9 to v1.1.0, libraries are no longer added to the maps api object.

<GoogleMapReact
  bootstrapURLKeys={{
    key: 'xxxxxxxxxxxxxx',
    libraries: ['places', 'drawing'],
  }}
  yesIWantToUseGoogleMapApiInternals
  onGoogleApiLoaded={({ maps }) => {
    console.log(maps.places); // undefined
    console.log(maps.drawing); // undefined;
  }}
/>

Activity

  1. itsmichaeldiego commented on Nov 13, 2018

    @itsmichaeldiego
    Member

    @tim-soft Good catch!

    This was introduced in #593

    I think for the time being, instead of passing libraries as you were, you can do:

    <GoogleMapReact
      bootstrapURLKeys={{
        key: 'xxxxxxxxxxxxxx',
        libraries: ["places", "drawing"],
      }}
      yesIWantToUseGoogleMapApiInternals
      onGoogleApiLoaded={({ maps }) => {
        console.log(maps.places);
        console.log(maps.drawing);
      }}
    />
    
  2. itsmichaeldiego commented on Nov 22, 2018

    @itsmichaeldiego
    Member

    @tim-soft This was fixed and deployed in 1.1.1, please let me know!

  3. faeron commented on Nov 28, 2018

    @faeron

    are both ways (as described in #681) broken now? For me using the "old" way doesn't work as long as heatmapLibrary={true} is used as described in the docs. It overrides set libraries here

    The "new" way with using props for each library isn't working at all, as only the heatmapLayer prop seems to be usable, other libraries are not implemented yet I assume?

    Is there any status on this and/or the PR?

  4. itsmichaeldiego commented on Nov 28, 2018

    @itsmichaeldiego
    Member

    @faeron I am sorry you're experiencing this, I reverted the change on 1.1.0 in 1.1.1, so it should work the same as 1.0.9, what is the problem you're experiencing?

  5. faeron commented on Nov 28, 2018

    @faeron

    no worries :)
    when using libraries in bootstrapURLKeys together with the propheatmapLibrary={true}it ignores all set libraries and only uses libraries=visualisation. This behavior seems to have the origin here
    as it appends the libraries param again, which overrides the others (as it is set last). The other libraries are not loaded then.

    I think it should not be a problem, when using it like in 1.0.9 only (without heatmap prop)

  6. itsmichaeldiego commented on Nov 28, 2018

    @itsmichaeldiego
    Member

    @faeron I see the problem, we are working on a total fix with @DonovanDeSmedt

  7. itsmichaeldiego commented on Feb 13, 2019

    @itsmichaeldiego
    Member

    @DonovanDeSmedt How are we looking on this man? Would love to see it happening

  8. DonovanDeSmedt commented on Feb 14, 2019

    @DonovanDeSmedt
    Contributor

    @itsmichaeldiego Lost it out of sight, I'll take a look at it the coming days

  9. barakplasma commented on May 16, 2019

    @barakplasma
    Contributor

    @DonovanDeSmedt would you like me to take over this issue for you? Specifically, to allow usage of bootstrapURLKeys.libraries prop array and the xyzLibrary={true} prop where we load all the libraries set to true from either source? We want to update the README.md to suggest one method or the other #686

  10. barakplasma commented on May 16, 2019

    @barakplasma
    Contributor

    As a recreation of the issue, see https://codesandbox.io/s/google-map-react-simple-map-yzeg2 which initializes a Google-Map-React map with the following props

    <GoogleMapReact
              bootstrapURLKeys={{ key: "", libraries: ["places", "drawing"] }}
              defaultCenter={this.props.center}
              defaultZoom={this.props.zoom}
              heatmapLibrary={true}
    >

    and check the network requests. I see the following request
    https://maps.googleapis.com/maps/api/js?callback=_$_google_map_initialize_$_&key=&libraries=places,drawing&libraries=visualization
    from the package.json: "google-map-react": "1.1.4",

  11. pablolizardo commented on Jun 12, 2020

    @pablolizardo

    Yes, in fact you have to disable the heatmapLibrary prop in order to get the libraries array working in the bootstrapURLKeys object.
    image

  12. itsmichaeldiego commented on Aug 3, 2020

    @itsmichaeldiego
    Member

    @ZAKdev Could you take a look at this?

  13. itsmichaeldiego commented on Aug 31, 2020

    @itsmichaeldiego
    Member

    Merged and released in 2.1.0, let me know if everything works fine for you folks!

  14. itsmichaeldiego commented on Sep 1, 2020

    @itsmichaeldiego
    Member

    Need to reopen this as I had to revert #921 which had a major bug.

    Will wait for @aviyadeveloper to fix it properly without causing bugs!

  15. NgHLong commented on Sep 2, 2020

    @NgHLong

    I got the problem with the "libraries" too, it's doubled the library, like when I import libraries = ["places"], it generates the url like this: &libraries=placesplaces

  16. itsmichaeldiego commented on Sep 3, 2020

    @itsmichaeldiego
    Member

    @NgHLong That is true, we're working on it here #934, stay tuned

  17. NgHLong commented on Sep 3, 2020

    @NgHLong

    Hey, just import the libraries and region ( libraries = ["places"], region: "VN"), and the URL will be fine.

  18. itsmichaeldiego commented on Sep 22, 2020

    @itsmichaeldiego
    Member

    Merged in #946 and Released in version 2.1.4, let me know if you encounter any problems!

    CC @NgHLong @pablolizardo @barakplasma @DonovanDeSmedt @faeron @tim-soft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions