Fix regression in mergeSourceDiffs: handle add/remove/removeAll #6342
Merged
Conversation
Collaborator
|
This looks great! |
HarelM
approved these changes
Sep 4, 2025
melitele
pushed a commit
to melitele/maplibre-gl-js
that referenced
this pull request
Sep 5, 2025
…ibre#6342) * fix mergeSourceDiffs add, remove, removeAll * add changelog entry * remove console.log from test * remove reproduction example --------- Co-authored-by: Harel M <harel.mazor@gmail.com>
ToHold
pushed a commit
to ToHold/maplibre-gl-js
that referenced
this pull request
Oct 31, 2025
…ibre#6342) * fix mergeSourceDiffs add, remove, removeAll * add changelog entry * remove console.log from test * remove reproduction example --------- Co-authored-by: Harel M <harel.mazor@gmail.com>
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.
Launch Checklist
PR #6163 improved performance by merging source diffs, but it also introduced regressions where the merged result could diverge from the expected behavior.
This PR fixes the inconsistencies in
mergeSourceDiffsby ensuring that:removeAll clears previous add and update operations
remove cancels out corresponding add and update operations
redundant add/remove sequences are properly neutralized
Fixes Regression with mergeSourceDiffs: add/remove/update inconsistencies #6339
Changes in this PR
Fixed
mergeSourceDiffslogic to correctly handle edge cases with add, remove, and removeAllAdded unit tests to cover the problematic cases:
Impact
This aligns mergeSourceDiffs with the semantics of applySourceDiff, ensuring consistency and preventing features from incorrectly persisting after removal.
CHANGELOG.mdunder the## mainsection.