Skip to content

fix(deck.gl-geotiff): call onSourceUnload for MosaicLayer's cached sources when it's removed - #823

Merged
kylebarron merged 2 commits into
mainfrom
kyle/mosaic-unload-on-finalize
Oct 30, 2026
Merged

kylebarron merged 2 commits into
mainfrom
kyle/mosaic-unload-on-finalize

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

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

When a MosaicLayer is removed, onSourceUnload now fires for every source the layer still holds.

deck.gl's Tileset2D.finalize clears its cache without calling onTileUnload, so MosaicLayer never reported those sources. MosaicTileset2D now unloads every cached item on finalize, as RasterTileset2D does for tiles (#728). An item still opening is unloaded once its open finishes, since deck.gl keeps what an aborted open returns anyway.

This is the first step toward #816. Re-opening sources through updateTriggers will replace MosaicLayer's inner TileLayer, which drops its cache the same way.

The override repeats RasterTileset2D.finalize. visgl/deck.gl#10883 would make deck.gl do this itself, and then both could go.

Ref #816

Tests

These run in deck.gl's LayerManager, and both failed before the fix:

  • removing the layer passes each loaded item's source to onSourceUnload;
  • an item still opening at removal is passed to it once its source arrives. Unloading the item right away instead fails this test.

🤖 Written by Claude Code

…urces when it's removed

deck.gl's `Tileset2D.finalize` clears its cache without `onTileUnload`, so
removing a MosaicLayer never called `onSourceUnload` for the sources it
still held. MosaicTileset2D now unloads every cached item on finalize, as
RasterTileset2D does (#728). An item still opening is unloaded once its
open finishes, since deck.gl keeps what an aborted open returns anyway.

Part of #816.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the fix label Oct 30, 2026
Comment on lines +88 to +89
* Unloads every cached item, which deck.gl's `finalize` skips (see #728). An
* item still opening is unloaded once its open finishes.

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.

We should point to visgl/deck.gl#10883 upstream

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.

Note

This reply was written by Claude (Claude Code), not by @kylebarron.

Done in 53581a1. This docstring now points to visgl/deck.gl#10883. I added the same pointer to RasterTileset2D.finalize, which works around the same deck.gl gap, so both overrides say they can go once #10883 lands.

🤖 Written by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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.

✅

@kylebarron
kylebarron merged commit 3b6d3ca into main Oct 30, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/mosaic-unload-on-finalize branch October 30, 2026 15:27
kylebarron added a commit that referenced this pull request Oct 30, 2026
> [!NOTE]
> This PR was written by Claude (Claude Code), not by @kylebarron.

Bumps `version` to `0.10.0-beta.2` in the root `package.json` and in
every `packages/*/package.json`. The publish workflow publishes it under
the `beta` dist-tag, so `latest` stays on 0.9.0.

`CHANGELOG.md` gets a `v0.10.0-beta.2` section with the one PR merged
since v0.10.0-beta.1, #823.

## Before pushing the tag

`@developmentseed/range-reader` needs a trusted publisher on npm, with
the same settings as the other packages: workflow `release.yml`,
environment `release`. The v0.10.0-beta.1 publish run failed at
`range-reader` without one, after it had published `affine`, `epsg` and
`proj`.

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

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant