-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Setting styleURL immediately after initialization sometimes fails #1767
Conversation
It looks like #1208 is about a wrong file path to the local style URL. My styleURL is actually working and loading, but once in 20 times (or another random number) that you open the app. The style got not applied to map. View with the default layout (hops in sometimes) I'm trying |
I've been meaning to log this. We are seeing this quite often as well. This is definitely a real issue. And is annoying as mentioned above. |
@picciano, if you’re also initializing and setting the style in separate steps, rather than using |
I'll try that and report back in a couple days. So far, so good. |
Using using |
Glad to hear it works. Unfortunately, |
Actually, |
Is this possibly fixed by #1802? |
@tmpsantos Can you investigate and determine if this is fixed? |
Sure! |
@jfirebaugh it is not fixed, good news is that I managed to reproduce on the linux app:
Sometimes I see |
I have a fix already. |
a9edd02
to
70b0466
Compare
Calling setStyleURL() multiple times in a short period of time will enqueue requests on the FileSource. The order they get replied is not guaranteed to be the same as the order we make the requests. The side effect was the last style set not always being the one rendered. Now we cancel the current request if we make a new one (and there was no point on keeping it around anyway).
5dd9ea5
to
295ea08
Compare
Ah, a request/response race condition -- this is a common error in client-side JS, funny to see it in C++ code. 👍 |
Sometimes when I start my app (iOS) with Mapbox in it, it won't load the styles into the map. It generates the default MapKit styled map, without any markers. It's kind of annoying, because the problem is somewhat occurring on a random base.
I load my custom stylesheet as a JSON file and link it to the map via the style url:
mapView?.styleURL = NSURL(string: "asset://\(jsonFile)")
Is it a known issue?