From cb1336fc97dda8b3ad99c3f9a9a560cf8186056b Mon Sep 17 00:00:00 2001 From: Martin Schuhfuss Date: Thu, 1 Feb 2024 14:54:24 +0100 Subject: [PATCH] fix: add `loading=async` to maps API url The new parameter loading=async signals to the API that we're not relying on the load-event of the script tag to determine the maps API status and allows the maps API to do some backward-incompatible performance-optimizations. --- src/libraries/google-maps-api-loader.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/google-maps-api-loader.ts b/src/libraries/google-maps-api-loader.ts index 222cbe60..c3c12e5e 100644 --- a/src/libraries/google-maps-api-loader.ts +++ b/src/libraries/google-maps-api-loader.ts @@ -121,7 +121,10 @@ export class GoogleMapsApiLoader { urlParams.set(urlParamName, value); } urlParams.set('libraries', library); + urlParams.set('loading', 'async'); urlParams.set('callback', '__googleMapsCallback__'); + + scriptElement.async = true; scriptElement.src = MAPS_API_BASE_URL + `?` + urlParams.toString(); window.__googleMapsCallback__ = () => {