Skip to content
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

Loading google maps JS API #3334

Open
TimWalkidenWebPro opened this issue Feb 13, 2024 · 7 comments
Open

Loading google maps JS API #3334

TimWalkidenWebPro opened this issue Feb 13, 2024 · 7 comments

Comments

@TimWalkidenWebPro
Copy link

TimWalkidenWebPro commented Feb 13, 2024

The following warning has started to appear when using the following @react-google-maps/api/src/LoadScriptNext.

Google Maps JavaScript API has been loaded directly without loading=async. This can result in suboptimal performance. For best-practice loading patterns please see https://goo.gle/js-api-loading

Is their a fix for this?

@keita-makino
Copy link

Wow, I've been just looking for this feature :O

@rhadooqoo
Copy link

You must update to the latest version and replace useLoadScript with the newer useJsApiLoader

import { useJsApiLoader } from "@react-google-maps/api";

@sderrow
Copy link

sderrow commented Mar 5, 2024

@rhadooqoo I'm not sure that solves the problem because this library is still using v1.16.2 of @googlemaps/js-api-loader, but that library only fixed loading=async as of v1.16.3 here.

@christopherboisvert
Copy link

@sderrow Updated to latest version and it worked for me. Thanks @nitya-nalamari 👍

@christopherboisvert
Copy link

This issue should be closed since it is resolved.

@Vitallyz
Copy link

Vitallyz commented Mar 18, 2024

Did not work for me (updated to 2.19.3). For now, injecting with the API key till the library is updated.

googleMapsApiKey: `${import.meta.env.VITE_GOOGLE_MAP_KEY}&loading=async`,

@nitya-nalamari
Copy link
Contributor

nitya-nalamari commented Mar 18, 2024

@Vitallyz loading=async was added for the LoadScript component in my PR. My PR was merged only a few days ago so not sure if it has been released yet.

The fix you mentioned is what I am currently using as well 😅

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

No branches or pull requests

7 participants