Repository navigation
fix: require deck.gl 9.4.2 and drop the tile unload overrides it makes redundant - #886
Merged
Merged
Conversation
…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
3 of 4 tasks
kylebarron
commented
Nov 24, 2026
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(); | ||
| } | ||
|
|
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(); | ||
| } | ||
|
|
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]>
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.
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.finalizecallsonTileUnloadfor every cached tile.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/onSourceUnloadcallbacks 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:
@deck.gl/*spec, including peer deps, pnpm overrides and examples, now requires^9.4.2. The lockfile moves only deck.gl.RasterTileset2D: removes thefinalizeoverride and the late-load guard from fix(deck.gl-raster): unload a tile whose load finishes after it was unloaded #878. TheabortUnwantedLoadswrapper ofonTileUnloadstays.MosaicTileset2D: removes thefinalizeoverride.reloadAllstays, because deck.gl'sreloadAllstill drops items without unloading them. It now calls deck.gl'sfinalize.custom-projectionexample: removes itsfinalizeoverride.MosaicLayer.onSourceUnloaddocs: 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) anddeck.gl-zarr(81) tests pass on 9.4.2.finalizefor a loading tile. It now expects an unload right away with no content, then another once the data arrives.biome cipasses.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