smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.02k stars 270 forks source link

"Google Maps JavaScript API has been loaded directly without loading=async" #393

Closed mugu-fatman closed 4 months ago

mugu-fatman commented 5 months ago

Hi , Thanks for the lovely plugin !!! I am using GeoSearchControl in my svelte application with google provider

        const provider = new GoogleProvider({ apiKey: "" })
    const searchControl = new GeoSearchControl({
                marker: { icon: icon},
                style: "bar",
                searchLabel: "search",
                resetButton: mdiMagnify,
                provider: provider,
                resultList: resultList
            });
            map.addControl(searchControl);
            map.on("geosearch/showlocation", (result) => getCoordinates(result));

Started getting warning from google api "Google Maps JavaScript API has been loaded directly without loading=async" and it has impact on the performance takes 10 - 30 secs for the map to load.

image

Could you suggest any fixes for this ?

Thank you

mugu-fatman commented 5 months ago

Found that issue is coming from this plugin

not sure how to fix it

mugu-fatman commented 4 months ago

Please provide some suggestion

smeijer commented 4 months ago

I'm going to guess, but I think it originates from the library we use, @googlemaps/js-api-loader.

mugu-fatman commented 4 months ago

Issue has been fixed in the latest version v1.16.6 is there any possibility to update ? @smeijer https://github.com/googlemaps/js-api-loader/commit/2d05217cd728175724e1fcf024e33e21cd9cc4b2

smeijer commented 4 months ago

Sure. Happy to merge any pull request fixing this. Please tag me in the PR.

smeijer commented 4 months ago

:tada: This issue has been resolved in version 3.11.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: