cedricdelpoux / cedricdelpoux/react-google-maps-loader

Feature Request: Don't fire callback until load callback from google maps fires

Open
#26 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
52
Forks
15
PR merge metrics
No merged PRs in 30d

Description

In our project, we've seen a bunch of "google maps is undefined errors" on mobile devices that seem to have slow connections, and my current hypothesis is the following:

1. Google maps script is injected
1. Bootstrap code is downloaded (i.e. not the library code itself)
1. script onLoad event fires before library code has finished loading
1. Google Maps is treated as loaded, but `window.google.maps` is still null/undefined.

One fix for the above behavior would be to take advantage of the [callback parameter](https://developers.google.com/maps/documentation/javascript/tutorial#Loading_the_Maps_API) on the google maps JS request.

Is this consistent with your experience? Are there challenges to implementing this? Otherwise I'd be happy to submit a PR.

Contributor guide

Open the contributing guide

Research direction

No file or test is named in the issue. Start by locating the Google Maps script injection and its script onLoad handling, then trace how the loader invokes its callback. Done means the callback waits for the documented Google Maps loading callback rather than assuming window.google.maps is ready.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.