Skip to content

Fix libraries being repeated when using heatmapLibrary #934

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

Closed
wants to merge 10 commits into from
Closed

Fix libraries being repeated when using heatmapLibrary #934

wants to merge 10 commits into from

Conversation

aviyadeveloper
Copy link
Contributor

@aviyadeveloper aviyadeveloper commented Sep 1, 2020

Fixes #922

API.md Outdated
@@ -384,8 +387,24 @@ interface heatmapProp {

#### Important Note

If you have multiple `GoogleMapReact` components in project and you want to use heatmap layer so provide `heatmapLibrary={true}` for all `GoogleMapReact` components so component will load heatmap library at the beginning with google map api.
If you have multiple `GoogleMapReact` components in project and you want to use heatmap layer provide `libraries:['visualization']` to `bootstrapURLKeys` so that the visualization library will be loaded with the google map api.
Copy link
Member

@itsmichaeldiego itsmichaeldiego Sep 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do something like:

If you have multiple instances of the map in your project and you are willing to use the heatmap layer in at least one of them, make sure to provide libraries:['visualization'] to bootstrapURLKeys so that the visualization library will be loaded with the google map api.

Maybe we could ask @NerdCowboy or @karldanninger to help us with the wording as they're native

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh a native touch could be good! wording docs is always tricky.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: @itsmichaeldiego you have a better perspective of the project so I assume your wording reflects the use-cases related better. On my part I just wanted the libraries prop from bootstrapURLKeys to not be "lost between the chairs" of the docs.

We wait for some english natives touch and i edit it. 🎉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated it with my recommendations in case they take some time to respond, I will merge it if we don't get an answer in the following days.

I will hit up @karldanninger in a PM to check if he will be available soon!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated! Let me know what you think @karldanninger @aviyadeveloper

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great @itsmichaeldiego @karldanninger 🚀

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aviyadeveloper Did you test everything thoroughly? I need some time to give it a test and I will merge it and release after that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itsmichaeldiego I would prefer you testing it than me. Since we already had the problems in the last PR and as I am new to the code-base and also pretty busy with work. When I have more time I will check out the testing mechanism and familiarize myself with that process better for future PRs to be stricter and more reliable. But this one should definitely pass your hands first.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course! I will test it thoroughly this time, just wondering if you were able to check those!

@itsmichaeldiego itsmichaeldiego changed the title Patch 1 / With fixed issues Fix libraries param being repeated when setting heatmapLibrary on true Sep 7, 2020
@itsmichaeldiego itsmichaeldiego changed the title Fix libraries param being repeated when setting heatmapLibrary on true Fix libraries usage and its repetition when using heatmapLibrary Sep 7, 2020
@itsmichaeldiego itsmichaeldiego changed the title Fix libraries usage and its repetition when using heatmapLibrary Fix libraries being repeated when using heatmapLibrary Sep 7, 2020
// Support for older version using heatMapLibrary option
if (heatmapLibrary) {
bootstrapURLKeys.libraries
? bootstrapURLKeys.libraries.append('visualization')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you're appending even if the library is present!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because duplicates get cleaned out anyways in:

    if (bootstrapURLKeys.libraries) {
      bootstrapURLKeys.libraries = bootstrapURLKeys.libraries.filter(
        (lib, i) =>
          bootstrapURLKeys.libraries.indexOf(lib) === i &&
          googleMapsLibs.includes(lib)
      );
    }

@itsmichaeldiego
Copy link
Member

@aviyadeveloper Hey! I created a new PR with parts of your PR and some fixes, here it is #946, I kindly ask you if you can review it and let me know if its okey! Thanks.

@itsmichaeldiego
Copy link
Member

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

@aviyadeveloper aviyadeveloper deleted the patch-1 branch September 22, 2020 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to all libraries.
3 participants