elastic / ems-landing-page

Previewer for the data of the Elastic Maps Service
https://maps.elastic.co
Other
2 stars 9 forks source link

Tiles are not showing after some layer-switching #201

Open thomasneirynck opened 4 years ago

thomasneirynck commented 4 years ago

Go to the landing page and switch a few boundary layers.

This will get logged:

2mapbox-gl.js:33 Uncaught (in promise) Error: Style is not done loading
    at r._checkLoaded (mapbox-gl.js:33)
    at r.addSource (mapbox-gl.js:33)
    at n.addSource (mapbox-gl.js:33)
    at s.value (map.js:164)
    at app.js:70
    at l (runtime.js:45)
    at Generator._invoke (runtime.js:274)
    at Generator.forEach.e.<computed> [as next] (runtime.js:97)
    at d (main.bundle.js?0fa4f70aedbd095bb70d:1)
    at i (main.bundle.js?0fa4f70aedbd095bb70d:1)
mapbox-gl.js:33 Uncaught (in promise) TypeError: Cannot read property 'version' of undefined
    at r.serialize (mapbox-gl.js:33)
    at n.getStyle (mapbox-gl.js:33)
    at s.value (map.js:141)
    at s.value (map.js:156)
    at app.js:87
    at l (runtime.js:45)
    at Generator._invoke (runtime.js:274)
    at Generator.forEach.e.<computed> [as next] (runtime.js:97)
    at d (main.bundle.js?0fa4f70aedbd095bb70d:1)
    at i (main.bundle.js?0fa4f70aedbd095bb70d:1)

The tiles will fail to show as well.

Haven't found a reliable way to reproduce.

jacknkandy commented 3 years ago
Uncaught (in promise) Error: Style is not done loading
    at r._checkLoaded (mapbox-gl.js:33)
Uncaught (in promise) TypeError: Cannot read property 'version' of undefined
       at r.serialize (mapbox-gl.js:33)

I've been getting these errors for years with an application I maintain. I rarely encounter this myself, but I see it in the error logs for other users. Would love to hear if anyone ever narrows it down!

jsanz commented 3 years ago

Interesting, I've seen that error on this project I'm contributing as well

https://geochicasosm.github.io/lascallesdelasmujeres/

That map does not change full styles and I was wondering if it would be related to adding the GeoJSON data too soon somehow. In this project I've seen it pretty frequently in development so it should be easier to investigate.

jacknkandy commented 3 years ago

Oh yeah I should mention that I am not using the ems-landing-page package (my bad I searched for this error on google and though I was in the mapbox-gl repo). I would presume that this error is unrelated to ems-landing-page and directly related to the underlying mapbox/mapbox-gl-js package.

thomasneirynck commented 3 years ago

thx @jacknkandy @jsanz for the confirmation.

Kibana explicitly waits for the Map:load event before adding any data with addSource

https://github.com/elastic/kibana/blob/658ecb6c8a97a6d182fb0e2907dc81cbd4a0c817/x-pack/plugins/maps/public/connected_components/mb_map/mb_map.js#L164

https://docs.mapbox.com/mapbox-gl-js/api/map/#map.event:load

It doesn't seem like the ems-landing-page is doing this, so maybe this is the reason for the error logs.

jsanz commented 3 years ago

On the women's streets project the viewer also waits for the load event.

https://github.com/geochicasosm/lascallesdelasmujeres/blob/master/src/services/MyApp.js#L66-L76

I tried now to reproduce it there and I couldn't trigger the error, I'll keep checking.

jsanz commented 3 years ago

I tried to reproduce the error without success: in development and on production, Firefox and Chromium browser, throttling the network, and switching basemaps but no luck :sweat: