-
-
Notifications
You must be signed in to change notification settings - Fork 934
Send GeoJSON data from worker to main if loaded from a URL #6811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6811 +/- ##
=======================================
Coverage 92.42% 92.42%
=======================================
Files 288 288
Lines 23807 23809 +2
Branches 5056 5058 +2
=======================================
+ Hits 22003 22005 +2
Misses 1804 1804 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
How about fetching it in the main thread instead of serializing it from the worker? |
|
There's no way to guarantee the browser will cache the response. If the response has a |
|
Does it make sense now to return the data in |
As we discussed in #6738, there are still cases where
I think it's worth having this method around for backwards compatibility. (Sidenote: If and when we're ready to make some breaking changes, I'd love to see |
|
If you have ideas for breaking changes please add them to the following issue: |
|
I'm not sure I'm following the last comment. If we now have the data on the main thread, as the user set it, what's the point of going to the worker to get it? |
|
I'll try to explain a different way: |
|
Oh! I might've explained the wrong part:
The only reason we must keep the full GeoJSON data on the main thread is to support the syncronous |
I thinks this is no longer true given the recent changes with reload tile and the possible solution for undefined properties, or am I understanding this wrong? |
|
In any case, we can always change that in a future PR, this code can be merged regardless of this discussion. |
It could easily be true if we merged #6801 instead of #6800; and chose one of the other possible solutions for undefined properties in #6803 |
Summary
Part of #4364
This PR carves out an exception from the optimization added in #6668. When GeoJSON data is loaded from a URL, we now send it back to the main thread so that it can be:
map.getStyle()GeoJSONSource#_getShouldReloadTileOptionsfor fasterGeoJSONSource#updateDataoperations (ref Use only bounds for geojson diff tile reload #6800)queryRenderedFeaturesto return original feature properties (ref fix: Don't serialize GeoJSON vector tiles from the worker to support undefined properties #6803)When GeoJSON is provided inline or via diff updates, the main thread already has the data, so we skip sending it back (preserving the #6668 optimization).
This will make
GeoJSONSource#updateDatamuch faster when the GeoJSON data was loaded from a URL.Benchmarks
Launch Checklist
CHANGELOG.mdunder the## mainsection.