js-samples icon indicating copy to clipboard operation
js-samples copied to clipboard

Autocomplete Widget example wrongly loads the Map class from the "places" library

Open andreimirt opened this issue 1 year ago • 0 comments

Operating system

Windows 11

Browser Version

Firefox 127

How severe is the bug?

low

Bug description

This example that loads an Autocomplete Widget tries to load the Map class from the "places" library. The example still works as intended because the Map class isn't required anywhere, so the"places" library is loaded anyway and then the PlaceAutocompleteElement class is referenced using the full namespace. The guide is made to be easy enough for non-js gurus. Probably js-gurus don't even bother with the guides and read just the reference, but it took me a full day to understand what #L11 actually does, because I started with the assumption that the official documentation is always correct. Now I know better. :smi https://github.com/googlemaps/js-samples/blob/ce94ea122e565fad7fd2152c950eea8e4f4747eb/dist/samples/place-autocomplete-element/docs/index.js#L7-L47

Steps to reproduce

Just run the JSFiddle example, to which I added a console.log('Map: ',Map) after the attempt to load the Map class from the "places" library is made.

Console log output

"Map: ", undefined

andreimirt avatar Jun 27 '24 07:06 andreimirt