Closed MattReimer closed 6 years ago
@MattReimer Is your mapStyle an Immutable
map? If not, can you give it a try?
@MattReimer Were you able to solve this issue? We're experiencing the same thing currently and we are using Immutable.
Same as well!
can you explain what do you mean by using Immutable? I'm currently having this issue in an app I'm developing. We use a url for mapStyle, so I'm not sure what an Immutable map actually mean in that context.
Would appreciate any help. thanks!
@sabres207 it's in reference to the Immutable.js library. Often used in conjunction with a state management library like Redux. Immutable map.
Hopefully that answers your question.
@jefferymills Thanks, yea I figured you were talking about Immutable.js, but I'm not sure how exactly should I use it and why would it work? because the map style is only a url. should I use Immutable map to hold that style url?
A little background: I'm building an app that requires layer management. I'm trying to add and remove layers from the map using switches and toggles.
My strategy has been to hold a
mapStyle
object in the redux state, then use redux actions and reducers to add/remove layers and then pass the wholemapstyle
into my map as a prop like this:My thought was that ReactMapGL would detect the differences and just pass them on to MapBoxGL but when I modify the
mapStyle
I'm seeing the entire map and all its layers reload which is time-consuming and very distracting.In the browser console I get the error:
So I can't help but wonder if I should be modifying the style some other way. Has anyone found a way around this?
Note: I think this may related to #116 but I'm not 100% sure