Skip to content

fix: require deck.gl 9.4.2 and drop the tile unload overrides it makes redundant - #886

Merged
kylebarron merged 1 commit into
mainfrom
deps/deck.gl-9.4.2
Nov 24, 2026
Merged

kylebarron merged 1 commit into
mainfrom
deps/deck.gl-9.4.2

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code) on behalf of @kylebarron, not by @kylebarron.

Closes #863

Problem

deck.gl 9.4.2 includes visgl/deck.gl#10883:

  • Tileset2D.finalize calls onTileUnload for every cached tile.
  • A tile whose load finishes after it left the cache is unloaded instead of reported loaded.

Our workarounds for 9.4.1 do the same thing. On 9.4.2, they unloaded every tile twice. That destroyed default-pipeline textures twice and ran user onTileUnload / onSourceUnload callbacks twice (#863). With the lockfile moved to 9.4.2, five tests failed this way before this change.

Change

This is option 2 from #863:

  • Every @deck.gl/* spec, including peer deps, pnpm overrides and examples, now requires ^9.4.2. The lockfile moves only deck.gl.
  • RasterTileset2D: removes the finalize override and the late-load guard from fix(deck.gl-raster): unload a tile whose load finishes after it was unloaded #878. The abortUnwantedLoads wrapper of onTileUnload stays.
  • MosaicTileset2D: removes the finalize override. reloadAll stays, because deck.gl's reloadAll still drops items without unloading them. It now calls deck.gl's finalize.
  • custom-projection example: removes its finalize override.
  • MosaicLayer.onSourceUnload docs: an item that is still opening is unloaded with no source, then again with its source once the open finishes.
  • onnx-embeddings/NOTES.md: no longer says the mid-load eviction leak applies.

Test plan

  • deck.gl-raster (263), deck.gl-geotiff (224) and deck.gl-zarr (81) tests pass on 9.4.2.
  • One test encoded 9.4.1 behavior, with no unload at finalize for a loading tile. It now expects an unload right away with no content, then another once the data arrives.
  • biome ci passes.
  • Not checked in a browser.

Follow-up: switch the examples to @deck.gl/maplibre (#661), which visgl/deck.gl#10734 in 9.4.2 unblocks.

🤖 Generated with Claude Code

https://claude.ai/code/session_011cLtCQHxJfGKqmXPYrjSPA

…s redundant

deck.gl 9.4.2 (visgl/deck.gl#10883) calls `onTileUnload` for every cached
tile in `Tileset2D.finalize`, and unloads a tile whose load finishes after it
left the cache. Our overrides of the same behavior now unloaded each tile
twice. Closes #863.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011cLtCQHxJfGKqmXPYrjSPA

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

✅

Comment on lines -238 to -252
/**
* Release every cached tile's resources before dropping the cache.
*
* deck.gl's `Tileset2D.finalize` clears the cache without calling
* `onTileUnload`, so the tiles' GPU textures would leak each time the tile
* layer is replaced, which this example does on every projection or dataset
* change.
*/
override finalize(): void {
for (const tile of this.tiles) {
this.opts.onTileUnload?.(tile);
}
super.finalize();
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

lgtm

Comment on lines -87 to -104
/**
* Unloads every cached item, which deck.gl's `finalize` skips until
* https://github.com/visgl/deck.gl/pull/10883 lands. An item still opening
* is unloaded once its open finishes.
*/
override finalize(): void {
const { onTileUnload } = this.opts;
for (const tile of this.tiles) {
if (tile.isLoading) {
// `data` is a promise until the load finishes
void Promise.resolve(tile.data).then(() => onTileUnload(tile));
} else {
onTileUnload(tile);
}
}
super.finalize();
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

lgtm

@kylebarron
kylebarron merged commit d4972d4 into main Nov 24, 2026
4 checks passed
@kylebarron
kylebarron deleted the deps/deck.gl-9.4.2 branch November 24, 2026 16:16
kylebarron added a commit that referenced this pull request Nov 24, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code) on behalf of @kylebarron,
not by @kylebarron.

Needs deck.gl 9.4.2, from #886. Supersedes #661.

### Why

deck.gl 9.4 adds `@deck.gl/maplibre`. #661 switched to it, but stayed a
draft: with 9.4.0, interleaved layers that set `beforeId` were drawn
above every MapLibre layer on first load (visgl/deck.gl#10733).
visgl/deck.gl#10734 fixes that in 9.4.2.

### Change

- The shared `DeckGlOverlay` uses `MapLibreOverlay` instead of
`MapboxOverlay`.
- `@deck.gl/mapbox` is replaced by `@deck.gl/maplibre` in
`examples/_shared` and the root pnpm overrides.
- The `@ts-expect-error` comments on `beforeId` now name
`@deck.gl/maplibre`.

### Test plan

- [x] `biome ci`, and `typecheck` and `build` of every example, pass.
- [x] `cog-globe` in headless Chrome (SwiftShader), first load with no
interaction: basemap labels and country borders draw above the raster,
as `beforeId: "boundary_country_outline"` intends. That's the case that
failed in #661.
- [x] Every other example that uses `DeckGlOverlay`, in headless Chrome
on a real GPU (GTX 950, ANGLE Vulkan), first load with no interaction:
- Labels or borders draw above the deck.gl layers, as their `beforeId`
intends: `aef-mosaic`, `cog-basic`, `dynamical-zarr-ecmwf`,
`geoarrow-overlay`, `land-cover`, `naip-mosaic`, `nldas-icechunk`,
`onnx-embeddings`, `pmtiles-terrain`, `titiler-cog`,
`vermont-cog-comparison`, `vrt-mosaic`, `zarr-globe`.
- No `beforeId`, so the layer draws on top, as before: `sentinel-2`,
`usgs-topo`.
- No console errors in any of them. Each logs `luma.gl: Binding sampler
not set`; I didn't check whether `@deck.gl/mapbox` logs it too.
- [ ] `zarr-sentinel2-tci` not checked: it reads from
`http://localhost:8080/TCI.zarr`, which wasn't running.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_011cLtCQHxJfGKqmXPYrjSPA

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid calling onTileUnload twice once deck.gl's finalize calls it (visgl/deck.gl#10883, in 9.4.2)

1 participant