Does not work with any of the map APIs (re-rendering incompatibility)
See original GitHub issueExpected behavior
With the library like leafletjs
or google maps API, choo
should render a geo map and then update (re-render) it without any problem.
Actual behavior
Upon emitting render
with updated coordinates (latitude and longitude), every map implementation dies and then displays blank container or , alternatively, empty, grey map. Tested with:
- Leaflet
- Google Maps
- Mapbox GL
It results in the same outcome.
Steps to reproduce behavior
Example code (map component):
import html from 'choo/html';
export default ({latitude = 51.505, longitude = -0.09, zoom = 18, markers = []},
emit) => {
const geoMap = html`<div id="map" style="height: 380px"></div>`;
if (typeof L !== 'undefined') {
const map = L.map(geoMap).setView([latitude, longitude], zoom);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
maxZoom: zoom,
id: 'mapbox.streets',
accessToken: 'apiTokenHere'
}).addTo(map);
}
return geoMap;
};
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
react-google-maps use without re-render - Stack Overflow
I Have 1 task and 1 problem. I use react-google-maps . My task is: add markers by the event. My problem - after...
Read more >google-map-react now load google maps api all the time even ...
UPDATE: It seems 2.1.3 seems to work. Note that this issue happens because I need to dynamically load google maps for other components...
Read more >Error Messages | Maps JavaScript API - Google Developers
If you receive only warnings without any errors, the API will work correctly on that page. However, we recommend that you fix these...
Read more >react-native-maps - npm
Issue: Since android needs to render its marker views as a bitmap, the animations APIs may not be compatible with the Marker views....
Read more >Backbone.js
Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Check out the example in https://github.com/yoshuawuyts/nanocomponent, you need to make sure that the DOM element is not recreated on each render, nanocomponent (and https://github.com/yoshuawuyts/microcomponent) help with this (:
On Wed, May 31, 2017 at 8:21 PM Maciej Sitko notifications@github.com wrote:
You are right, its even on the forefront of github 😃 My bad