Repository navigation
Conversation
4 of 8 tasks
mfazekas
force-pushed
the
feat/shapesource-partial-updates
branch
from
November 6, 2026 06:35
4728f03 to
d2690bd
Compare
Thin ref methods over the Mapbox SDK partial GeoJSON updates on iOS and Android, with the SDK's optional dataId, so a small change to a large source doesn't resend the whole shape.
mfazekas
force-pushed
the
feat/shapesource-partial-updates
branch
from
November 14, 2026 21:29
d2690bd to
eee44af
Compare
…hape race A refused id keeps the features before it, but they appear only with the next accepted change. On Android a call made right after a new shape can reach the map first and be replaced by it. Checked on an iOS simulator and an Android emulator.
…thread on iOS dataId isn't observable from rnmapbox: the SDK event carrying it isn't exposed and refusal errors report it empty. iOS decodes the features JSON on a serial background queue and applies the change on main, keeping order with other partial updates and with shape updates made while one is pending.
…change Partial calls decoded their features on the module thread before hopping to the UI thread, so a shape mount could be queued ahead of them and features from before that shape survived into it. Hop first and decode on the source data thread, in order with shape updates.
This branch was previously deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Added
addFeatures,updateFeaturesandremoveFeaturesref methods onShapeSource, as requested in #4234. They call the Mapbox SDK partial GeoJSON updates on iOS and Android, so a small change to a large source doesn't resend the wholeshape. The SDK'sdataIdis not exposed: rnmapbox doesn't surface the event that carries it, and refusal errors report it empty.There is little on top of the SDK. The features JSON is decoded off the main thread on both platforms. On Android the call then runs on the thread that already applies
shapeandurlchanges; on iOS it is applied on main in call order with other partial updates and withshapeupdates made meanwhile. The promise resolves once the map has the call. The SDK limits are in the JSDoc: features need a uniqueidorpromoteId; a refused id (duplicate add, missing update or remove) stops that call there, keeps the features before it but shows them only with the next accepted change, and reports the id throughonMapLoadingErrorwith typesourceand as a Mapbox error, which development builds show in LogBox;setFeatureStatestays the cheaper choice for paint-only changes.Two ordering gaps are documented, not handled. On Android a call made in the frame a new
shaperenders in can reach native before the shape mount and is then replaced (3 of 30 tries with the call right after thesetState, 0 of 30 one frame later). On iOS aurlchange doesn't wait for pending calls.Performance, release builds, 50k points at street zoom, 50 updates of 10 features at 5 Hz, one run per mode (JS ms per update p50, timer lateness p50, process CPU, time for the last update to show):
shape: 589 ms, 8.3 s late, 131 s CPU, not caught up after 60 s.feature-state: 1.3 ms, 1.1 s late, 6.5 s CPU, 12 ms to catch up.shape: 87 ms, 17 ms late, 12.2 s CPU, 0.5 s to catch up.feature-state: 0.2 ms, 17 ms late, 0.6 s CPU, 0 ms to catch up.The gain is on the JS thread. On Android the SDK still reprocesses the source for every call, so a sustained stream of calls on a large source falls behind; fewer, larger calls or
feature-statekeep up. The emulator is noisy: thefeature-statelateness was 26 ms in an earlier run. These numbers were measured before the iOS decoding moved off the main thread.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Screenshot OR Video
Checked on an iPhone 17 simulator and an Android emulator with the
Partial feature updatesexample and a release-build harness: numeric and string ids, add, update and remove, refusals in the middle of a call, and calls around ashapechange. On Android, a burst of 41 partial calls followed by a newshapenow ends on that shape alone in 24 of 24 rounds (it kept 9 to 15 stale features in 3 of 3 before). updateFeatures with 5k, 20k and 50k features resolved in about 240, 430 and 900 ms with main-thread latency p50 under 1 ms during each.