Skip to content

fix(maplibre,mapbox): remove the overlaid container when the overlay is removed - #10899

Merged
chrisgervang merged 2 commits into
masterfrom
chr/overlay-remove-container
Oct 23, 2026
Merged

chrisgervang merged 2 commits into
masterfrom
chr/overlay-remove-container

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #8914

Background

MapLibre and Mapbox leave removing a control's element to the control. MapLibreOverlay and MapboxOverlay never removed theirs in overlaid mode, so every remount left a container in the map. With a device prop, Deck doesn't own the canvas, so it leaves it in place on finalize. The next overlay with that device then finds the canvas still attached, inside a stale container that no longer resizes with the map. After a window resize, deck draws at the old size and drifts from the basemap.

On the website, switching WebGL2/WebGPU in the BitmapLayer example and then resizing the window reproduces it. The bug has been there since @deck.gl/maplibre shipped in 9.4.0.

Change List

  • MapLibreOverlay, MapboxOverlay: remove the container in onRemove
  • Tests: assert the container is removed, on MapLibre 4/5/6 and on the mock Mapbox map. The mock map now places control elements as Mapbox does.

…is removed

MapLibre and Mapbox leave removing a control's element to the control, so
every overlaid overlay left its container in the map's top-left control slot.
With a `device` prop, Deck does not own the canvas and leaves it in place on
finalize. The next overlay using that device found the canvas still connected,
in the stale container, and left it there. That container no longer resized
with the map, so after a window resize deck rendered at the old size and drew
misaligned with the basemap.
@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Removes overlaid containers when MapboxOverlay and MapLibreOverlay leave the map.

  • Removing an overlaid map control also removes its container.

Reviews (2) · Last reviewed commit: "Merge branch 'master' into chr/overlay-r..." · Reviewed by Greptile

@coveralls

coveralls commented Oct 23, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.11% (+0.001%) from 84.109% — chr/overlay-remove-container into master

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The overlaid container cleanup is covered by regression tests, the current CI workflow passed, and the PR is mergeable.

@chrisgervang

Copy link
Copy Markdown
Collaborator Author

Released in deck.gl 9.4.1.

kylebarron added a commit to developmentseed/lonboard that referenced this pull request Nov 13, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

Bumps:

- `@deck.gl/*` 9.4.0 →
[9.4.1](https://github.com/visgl/deck.gl/releases/tag/v9.4.1)
-
`@developmentseed/{deck.gl-raster,affine,morecantile,raster-reproject}`
0.8.1 →
[0.9.0](https://github.com/developmentseed/deck.gl-raster/releases/tag/v0.9.0)
→
[0.10.0](https://github.com/developmentseed/deck.gl-raster/releases/tag/v0.10.0)

The deck.gl overrides in `pnpm-workspace.yaml` go to `^9.4.1` too.
Without that, pnpm keeps every overridden deck.gl package at 9.4.0 and
only `@deck.gl/react` moves. deck.gl-raster 0.10 now depends on
`@developmentseed/range-reader`, so I added it to the commented-out
local-checkout overrides.

The breaking changes in deck.gl-raster 0.9 and 0.10 are in
`deck.gl-geotiff`, `deck.gl-zarr` and `geotiff`, which Lonboard doesn't
use. Lonboard only imports `RasterTileLayer`, `TileMatrixSetAdaptor` and
`MinimalTileData`, and needs no code changes.

Upstream fixes relevant to Lonboard:

- deck.gl-raster: tile textures are destroyed when a raster layer is
removed (developmentseed/deck.gl-raster#728), and a WebGL vertex array
no longer leaks per tile (developmentseed/deck.gl-raster#786).
- deck.gl-raster: missing TileMatrixSet bounds are inferred and `extent`
is honored (developmentseed/deck.gl-raster#684). The `TMSBoundingBox`
step in `examples/raster-titiler.ipynb` (#1327) should no longer be
needed. That isn't tested here.
- deck.gl: the MapLibre overlay container is removed with the overlay
(visgl/deck.gl#10899), and `GlobeController` can zoom past level 12
(visgl/deck.gl#10737).

The `beforeId` fix for interleaved MapLibre (visgl/deck.gl#10734) merged
after 9.4.1, so the `idle` workaround tracked in #1293 stays.

Supersedes Dependabot's #1350, which stops at deck.gl-raster 0.9.0.

Closes #1350

## Testing

- `pnpm build`, `pnpm check` and `pnpm test` (12 tests) pass.
- `uv run pytest` passes: 367 passed, 1 skipped, including `tests/ui`.
- `tsc --noEmit` reports the same 9 errors as `main`, and no new ones.
- No test covers `RasterLayer.from_geotiff`, the only path that uses
deck.gl-raster's `RasterTileLayer`. I checked it by hand with a
throwaway UI test. It opens a 2048×2048 EPSG:32618 COG with 3 overviews
and renders it with no basemap. Tiles reach the canvas on this branch
and on `main`, and the browser console output is the same on both.

🤖 Written by [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

[Bug] Removing a MapboxOverlay control doesn't remove its parent div

3 participants