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.
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. Both platforms decode the features JSON off the main thread; on iOS the change is then applied on main in call order with other partial updates and with
shapeupdates 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 typesource;setFeatureStatestays the cheaper choice for paint-only changes. On Android a call made right after a newshapecan reach native before that shape and is then replaced by it (3 of 3 tries); this is documented, not handled.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 a call right after ashapechange behaved as described above on both platforms. The latest change (droppingdataId, iOS decoding off the main thread) still needs a device re-check.