Skip to content

Fix regression in mergeSourceDiffs: handle add/remove/removeAll #6342

Merged
HarelM merged 6 commits into
maplibre:mainfrom
lhapaipai:fix/geojson-merge-source
Sep 4, 2025
Merged

Fix regression in mergeSourceDiffs: handle add/remove/removeAll #6342
HarelM merged 6 commits into
maplibre:mainfrom
lhapaipai:fix/geojson-merge-source

Conversation

@lhapaipai
Copy link
Copy Markdown
Contributor

@lhapaipai lhapaipai commented Sep 3, 2025

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 mergeSourceDiffs by ensuring that:

Changes in this PR

Fixed mergeSourceDiffs logic to correctly handle edge cases with add, remove, and removeAll

Added unit tests to cover the problematic cases:

  • add → removeAll
  • removeAll → add
  • update → remove
  • add → remove
  • remove → add → remove

Impact

This aligns mergeSourceDiffs with the semantics of applySourceDiff, ensuring consistency and preventing features from incorrectly persisting after removal.

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Add an entry to CHANGELOG.md under the ## main section.

@HarelM
Copy link
Copy Markdown
Collaborator

HarelM commented Sep 3, 2025

This looks great!
I'm currently working on making coverage work again, so please give me a day or two to complete this and then I want to check it with the PR.

@HarelM HarelM enabled auto-merge (squash) September 4, 2025 06:16
@HarelM HarelM merged commit df7ec4a into maplibre:main Sep 4, 2025
42 of 43 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression with mergeSourceDiffs: add/remove/update inconsistencies

2 participants