Skip to content

Conversation

@wayofthefuture
Copy link
Collaborator

@wayofthefuture wayofthefuture commented Sep 19, 2025

Summary
This PR fixes an issue where parent tiles were being retained/requested even when deeper descendant tiles already covered the missing ideal tile.

Background
Previously, _updateRetainedTiles only checked one level of children before falling back to parent tiles. Meanwhile, _retainLoadedChildren correctly seeks descendants up to maxCoveringZoom (e.g. 4, 16, 64 tiles for successive generations). This mismatch causes unnecessary parent retainment.

Change
Instead of duplicating multi-generation logic in _updateRetainedTiles, the function now relies on _retainLoadedChildren to report ideal tiles with incomplete descendants. This keeps the logic consistent and prevents redundant parent retainment/requests.

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

…r an ideal tile covered by 2nd generation children
@wayofthefuture wayofthefuture changed the title Fix issue where parent tiles are being retained when deeper descendant tiles already covered the missing ideal tile. Fix issue where parent tiles are retained when deeper descendant tiles already cover the missing ideal tile. Sep 19, 2025
@wayofthefuture wayofthefuture marked this pull request as ready for review September 19, 2025 16:48
@HarelM
Copy link
Collaborator

HarelM commented Sep 20, 2025

Looks good otherwise, thanks again for digging into this!

@wayofthefuture
Copy link
Collaborator Author

I forgot to remove the throw test then mispelled the commit! Sorry for the force pushes. Otherwise, all done!

@HarelM HarelM merged commit e5de3a6 into maplibre:main Sep 21, 2025
26 checks passed
@wayofthefuture wayofthefuture deleted the fix-double-retain branch October 14, 2025 14:35
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Jan 8, 2026
…s already cover the missing ideal tile. (maplibre#6442)

* Add failing test to show where parent tiles are retained/requested for an ideal tile covered by 2nd generation children

* add appropriate tests and modify nth generational retainment logic

* change log, build size

* rename test, remove throw

---------

Co-authored-by: wayofthefuture <wayofthefuture@users.noreply.github.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.

2 participants