question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GeoJSONLayer does not work with style-update

See original GitHub issue

Initially in my code, I was getting this (doesn’t happen in this example PR).

geojson-layer.js:77 Uncaught TypeError: Cannot read property 'setData' of undefined
    at GeoJSONLayer.componentWillReceiveProps (geojson-layer.js:77)

Fails right here:

    if (props.data !== data) {
      (map.getSource(id) as MapboxGL.GeoJSONSource).setData(props.data);
    }

map.getSource(id) is returning undefined.

I tried cloning the library and updating the example to show this: https://github.com/alex3165/react-mapbox-gl/pull/260

In the example, there are no errors in the console, but the layer is not re-rendered. If you check out that branch and go to the “Style update” tab, you can see what I’m talking about.

If you switch the style the GEOJSONLayer is NOT re-rendered.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
alex3165commented, Jun 14, 2017

Hey, Thank you for the issue I will handle this with the v2.0.0 milestone

2reactions
alex3165commented, Jun 16, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Editor widget doesnt work with GeoJSONLayer in 4.2...
I'm not able to get the Editor widget to work with a GeoJSONLayer in the 4.22 version, but in the 4.21 version with...
Read more >
GeoJSONLayer | ArcGIS Maps SDK for JavaScript 4.25
Each GeoJSONLayer will only accept one schema of the properties. The fields property can be used to specify the desired fields for the...
Read more >
Cluster geojson Layer doesn't work with marker filtering
As I added some filter and styling features according to properties, I'm unable to find the right way to code the cluster fonction....
Read more >
JSON layer does not show when .setview changes
I've set a Mapbox map with a GeoJSON layer overlaying it. The problem is that with the default set values, the JSON layer...
Read more >
GeoJsonLayer - deck.gl
This prop is effective only when the polygon is NOT extruded. getFillColor (Function|Array, optional) transition-enabled. Default: [0, 0, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found