This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Use stale styles - #2721
Merged
Merged
Use stale styles#2721
Conversation
kkaefer
force-pushed
the
2721-load-stale-styles
branch
3 times, most recently
from
January 7, 2016 11:24
df6c156 to
b10541e
Compare
kkaefer
force-pushed
the
2721-load-stale-styles
branch
3 times, most recently
from
January 7, 2016 18:06
b403380 to
5ed4d4e
Compare
This was referenced Jan 7, 2016
Closed
kkaefer
force-pushed
the
2721-load-stale-styles
branch
from
January 7, 2016 20:15
5ed4d4e to
5f13429
Compare
Member
Author
Member
Author
Contributor
|
This PR has a lot of changes and is hard to review comprehensively. Is it possible to split it up into smaller units? |
Member
Author
|
Will roll this again after #3480 is in. |
kkaefer
force-pushed
the
2721-load-stale-styles
branch
from
January 14, 2016 21:29
5f13429 to
2ed13a8
Compare
Member
Author
|
@jfirebaugh pls 👀 (minus the first two commits) |
jfirebaugh
added a commit
that referenced
this pull request
Jan 15, 2016
Until #2721 lands we still need this.
This adds support for using cached styles that are stale. They're treated like changing styles; when the refreshed style changed compared to the one we've already had, we're swapping out the entire style, which might cause a slight flicker.
We're now supporting using stale TileJSON and GeoJSON data. When we receive a new answer with an updated TileJSON file, we're replacing the Source's metadata with the new one and trigger updates to make sure we're loading the correct tiles. Similarly, GeoJSON data will be reparsed.
Otherwise, this will remove them from the map and overwrite the old data. This could happen e.g. when we have connection trouble and a tile needs to be refreshed, or we're displaying stale information and the connection is down.
kkaefer
force-pushed
the
2721-load-stale-styles
branch
2 times, most recently
from
January 15, 2016 12:33
c4f35aa to
88d72fe
Compare
This is a naïve implementation that essentially merges updated data into existing data. It will *not* remove icons from the stale sprite if they aren't present in the fresh sprite (we aren't tracking the source of a sprite, and the user could have changed it as well). Similarly, it will not update icons that have changed in dimension. This is a rare edge case and probably not worth implementing.
Previously, we could first get a stale response from cache, then immediately a "connection error" response that overwrote the error state variable. In the tileLoadingCompleteCallback, we'd only see the second overwritten error state and abort. This could lead to the map sometimes not being rendered at all until the user interacts with the map.
Updating glyphs is still unsupported, and there's no good use case for doing so. When we're using a stale glyph PBF, and the fresh answer contains changed to that glyph, we will continue to use the old glyph.
kkaefer
force-pushed
the
2721-load-stale-styles
branch
from
January 15, 2016 16:07
88d72fe to
a88e58e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With #2617 in place, we now get stale data from the cache. Currently, stale styles aren't used, but we should change this. This could be trivially implemented by regular style update (= treat it like setting a new style). Currently, this means that we have to reparse everything, and will see a short flicker. However, as soon as we implement style transitions (#2445), we'll get a flicker-free update.