Repository navigation
test(deck.gl-geotiff): check that a new renderSource reaches loaded MosaicLayer items - #844
Merged
Merged
Conversation
…osaicLayer items Co-Authored-By: Claude Opus 5.5 <[email protected]>
kylebarron
added a commit
that referenced
this pull request
Nov 5, 2026
…iggers.getSource changes (#848) > [!NOTE] > This PR was written by Claude (Claude Code), not by @kylebarron. `MosaicLayer` caches the source that `getSource` opens for each item. Until now, nothing opened those sources again. When something `getSource` reads changed, loaded items kept their old sources and only items loaded afterward used the new ones, so the mosaic could show a mix of both. Now a change to `updateTriggers.getSource` or `updateTriggers.all` opens every source again: ```ts new MosaicLayer({ data: items, getSource: (item, options) => COGSource.open(item.assets[band].href, options), updateTriggers: { getSource: band }, renderSource: (item, { source, subLayerProps }) => new COGLayer({ ...subLayerProps, source }), }); ``` - **How it works:** - MosaicLayer hands `updateTriggers.getSource` to its inner `TileLayer` as `updateTriggers.getTileData`, and `all` as `all`. When either changes, deck.gl's `TileLayer` calls the tileset's `reloadAll`, as it does upstream. - `MosaicTileset2D` overrides `reloadAll`. It unloads every source through `finalize` (#823), which also aborts the opens in flight. Then it makes the next update select the items in view again, and they open with the current `getSource`. Items out of view are opened when they come back. - **The old items stop drawing at once,** as #818's tiles do. - **A new `getSource` function alone opens nothing again,** as with deck.gl's accessors. - **deck.gl's own `reloadAll` is replaced** (#816): - It drops items out of view without unloading them, and keeps them in `tileset.tiles`. - It keeps drawing the items in view with their old sources until the new ones open, and never unloads the old ones. - The override stays until we adopt deck.gl v10's shared `Tileset2D` (#846). Its `reloadAll` unloads the tiles it drops, but still not the data a reload replaces. `renderSource` gets no trigger. Every render of MosaicLayer already draws the loaded items again with the current `renderSource`, and #844 tests that. RasterTileLayer still refetches through a count in its inner `TileLayer`'s id (#818). A follow-up moves it to the same override. ## Changes - **`MosaicLayer`** passes the two triggers to its inner `TileLayer`, and stores nothing. - **`MosaicTileset2D`** overrides `reloadAll`. - **Docs:** `getSource`'s docs say when and how to open the sources again. - **Spec:** decision 26 records this and the `renderSource` decision. The 4c entry points to it. ## Tests - **Runtime**, through deck.gl's `LayerManager`: - A change to `updateTriggers.getSource`, and to `updateTriggers.all`, opens every source again with the new `getSource`, and passes the old sources to `onSourceUnload`. - An unchanged trigger opens nothing again, even with a new `getSource` function. - The old items stop drawing at once, before the new sources open. - **`MosaicTileset2D`:** `reloadAll` unloads every item, and the next update selects the items in view again, even though the viewport hasn't changed. - **Replaced test:** #789 had a test that `all` doesn't open the sources again. `all` now opens them again, through the override instead of deck.gl's `reloadAll`. - **Mutation checks:** - Without the `setOptions` call in the override, 1 test fails. - Without the `getTileData` trigger, 2 tests fail. - Without the `all` trigger, 1 test fails. - Without the override, 4 tests fail. - **Everything else:** all 222 `deck.gl-geotiff` tests pass, as do the workspace typecheck and Biome. In Chrome, naip-mosaic still loads and pans with no errors. Closes #816 🤖 Written by [Claude Code](https://claude.com/claude-code) --------- 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), not by @kylebarron.
This PR adds a test: when MosaicLayer gets a new
renderSource, an item that has already loaded is drawn again with it, and its source isn't opened again.That works because MosaicLayer builds a new tileset class on every render. The inner
TileLayercomparesTilesetClassby identity, so it redraws every loaded item, and each one calls the currentrenderSource. Nothing tested this, so moving the class out ofrenderTileLayerwould have stopped it without any test failing (#816).deck.gl's own
TileLayerhandles this case withupdateTriggers.renderSubLayersinstead. This PR keeps MosaicLayer's current behavior, as #734 did forRasterTileLayer.Mutation check: reusing the first render's tileset class fails 13 tests, including this one. The other 12 fail because the new class is also how the inner
TileLayernotices new items, and those tests all changedata. This test keepsdatathe same, so it's the only one that checksrenderSourceon its own.Ref #816
🤖 Written by Claude Code