feat: Migrate and modernize React Place Autocomplete sample - #1602
Open
willum070 wants to merge 16 commits into
Open
feat: Migrate and modernize React Place Autocomplete sample#1602willum070 wants to merge 16 commits into
willum070 wants to merge 16 commits into
Conversation
Change-Id: Ibd4d5bc42aa695d03d54b69ad16cd21e1fc64ea8
Change-Id: I0ef57901fd67ae7152217516f956e4b59b9207e3
Change-Id: I0cce1dda39c055dfbac6ccce8958f4f4d226562f
Change-Id: Ifff9d52a47f7b405a4c2b645c2eb600a47b2354c
Change-Id: Ifb8641ba611c95d5d3232e123b3431e56ff54cdd
…es docs Change-Id: Id19072e7159ffef4df6cd9a5a8026a3ed1af8ae0
Change-Id: Ie115a8493247cde3fc3231221876f3b176e8c859
Change-Id: Ic29906ff21ab6322d4577c87c66e7ff18e1fddcf
Change-Id: I081ccefcc4ba6e960216ebf4f70734052f92aea6
Change-Id: I76e65cbd7110c633d1e623ab54b4f28e95cf2f7a
Change-Id: Icf6ae6e266fd7d5939ef7975e6f4a148ef0159b1
Change-Id: I8a86b395397d95b6b75e82ae48779eb978454213
Change-Id: Ib0e14557304be28023be5d45284b8c7d3dbabe6a
Change-Id: I93bf9f4c2b98d2ea6669b16e550f4e49427cf0c1
|
Here is the summary of changes. You are about to add 5 region tags.
This comment is generated by snippet-bot.
|
Change-Id: Ic4d6705f0b11ce28b60ee4cd589bd56a1da6e9c3
Change-Id: I4acaa1da9fc41b16dd990e8cf77fd78cf0e8f080
anglarett
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR overhauls the
rgm-autocompletesample to use the modern Google Maps Places API and the new<gmp-place-autocomplete>Web Component. It serves as a definitive guide for developers on how to correctly integrate the new Places API and Web Components within a React (@vis.gl/react-google-maps) environment while maintaining strict type safety.Key Changes
PlaceAutocompleteElementviauseMapsLibrary('places').refto reliably capture customgmp-selectevents, avoiding React's synthetic event system quirks with Custom Elements.PlaceClass Usage: Demonstrated the core design principle of the new API by capturing thePlacePredictionSelectEvent, callingplacePrediction.toPlace(), and explicitly requesting data viafetchFields()to ensure users only request the data they need.locationRestrictionproperty. Crucially, this uses.toJSON()(e.g.,map.getBounds().toJSON()) to safely bypass React cross-contextinstanceofobject limitations.@typescript-eslintcomplaints, including correctly typing custom event listeners, avoiding floating promises onfetchFields(), and strictly typing catch blocks.README.mdto act as a comprehensive guide for developers, specifically calling out common "gotchas" when bridging React and the new Places API.google.maps.event.removeListener(listener). This prevents "zombie" event listeners from persisting when the component remounts.Testing
npm run build).npm start), successfully biases predictions to the map's current bounds, and correctly fetches Place details/geometry upon selection.