Comments (6)
I just made a new release 0.8.3 which should in theory solve the problem you've been seeing.
At least I did find and fix a bug in our API loader that would explain the status of the second APIProvider not getting updated.
There might be other issues with your setup (nobody thought of having multiple react-roots in the same page), but please let me know once you tested it.
from react-google-maps.
The Problem seems to be that any APIProviders added after the initial one gets stuck in the Loading state
The first one is loaded and works fine
second one stuck during loading
from react-google-maps.
I'm not familiar with ASP.NET, am I reading this correctly that you have mutiple React render-roots in the same page? Or is that one application that gets hydrated from the entire html?
In general, there should only be a single APIProvider
in the application. The way this is supposed to be handled is by having all the providers at a very high level in the applications component tree (all our examples may be a bit misleading here since they are too small to make this separation).
The problem with having multiple providers is this: there can only ever be a single instance of the maps api loaded on the page, and that is associated with parameters such as the API-key, region and language settings and other details and there can't be multiple instances of the maps API within the same page (so something like two maps in different languages are not possible).
When we allow multiple API-providers, which one gets to decide on the values to use for loading the API?
That being said, I still think there's a subtle bug in there: The way it's supposed to work in your case is that the first APIProvider
being rendered will trigger loading the maps API and any other APIProvider should be able to detect the API already been loaded (there is some logic in place that our api-loader will not try to load the maps API if it has already been loaded by other means). I'll have a look if there's something wrong with that code.
from react-google-maps.
hi @usefulthink
yes you got this right, we have multiple React render-roots in the same page.
thanks for taking the time to check if it's a bug.
not sure if this could help in any way
tinkering with the react dev tools and setting the state of GoogleMapsApiLoader to "LOADED" like the first instance of the APIProvider seem to load the second map
from react-google-maps.
@usefulthink
Just tested it, and it seems to be working great.
thanks again and I will keep an eye for any problem that may arise in our setup.
from react-google-maps.
Awesome, thanks for letting me know!
from react-google-maps.
Related Issues (20)
- [Feat] Replace useMemo with useState for one time initializations HOT 2
- Use the API libraries without the need of using a map first [Feat] HOT 5
- [Feat] AdvancedMarker: add style prop HOT 1
- Map returned undefined HOT 4
- [Bug]Cannot remove a WebglOverlay
- [Bug] AdvancedMarker className prop should also be applied when using a Pin instead of custom content
- <ApiProvider> failed to load Google Maps API Error HOT 4
- [Feat] Add support for InfoWindow headerContent / headerDisabled options HOT 10
- Add className and style prop to the MapControl component HOT 1
- [Bug] Warning: useLayoutEffect does nothing on the server HOT 4
- [Bug] InfoWindow anchor reference not cleared on unmount HOT 8
- How can I animate the route to show a pulsating trail? HOT 5
- [Bug] Open two infowindow when clicking the marker HOT 1
- [Feat] Add padding option to defaultBounds HOT 5
- [Feat] Change the language HOT 1
- [Bug] On clicking AdvanceMarker to open InfoWindow, goes into an Infinite loop of rendering on setting markerRef(marker) manually HOT 8
- Marker icons are showing along with marker cluster HOT 2
- [Bug] Infinite loop using AdvancedMarkers when the marker items are changed HOT 2
- [Bug] Cannot remove a WebglOverlay that has not been set to a map
- [Bug] AdvancedMarker onDragEnd event triggers Map's onClick event
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-google-maps.