Forward updateTriggers to the inner TileLayer, so tiles can be refetched
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- data-visualization, frontend, testing
Research direction
Start with packages/deck.gl-raster/src/raster-tile-layer/raster-tile-layer.ts and packages/deck.gl-geotiff/src/mosaic-layer/mosaic-layer.ts, then compare their inner TileLayer props with deck.gl's TileLayer trigger behavior cited in the issue. Add tests with @deck.gl/test-utils for render, refetch, all, and opacity behavior; the issue lists each expected result. Done means the trigger mappings and documentation match those behaviors and the tests pass.
Written by the indexing model from the issue text.
Description
[!NOTE]
This issue was written by Claude (Claude Code) on behalf of @kylebarron, not by @kylebarron.
Problem
RasterTileLayer (and so COGLayer and ZarrLayer) and MosaicLayer build their inner deck.gl TileLayer themselves. They pass it only some of the caller's updateTriggers:
RasterTileLayermapsupdateTriggers.renderTileto the innerrenderSubLayerstrigger, and passes nothing else (raster-tile-layer.ts#L408-L410).MosaicLayerpasses none (mosaic-layer.ts#L247).
deck.gl's TileLayer refetches only when data changes, or when updateTriggers.getTileData or updateTriggers.all changes (tile-layer.ts#L229-L252). Any other change rebuilds the loaded tiles' sublayers from the data they already have. A new getTileData function on its own doesn't count, because deck.gl ignores changed function props (prop-types.ts#L188-L196).
That leaves three gaps.
1. No trigger can refetch tiles
COGLayer and ZarrLayer wrap whichever getTileData, and for ZarrLayer whichever selection, is current at each render (cog-layer.ts#L321-L354, zarr-layer.ts#L364-L373). When either changes, tiles loaded afterward use the new one, but cached tiles keep their old data, so the layer shows a mix.
No updateTriggers key reaches the inner TileLayer's getTileData trigger. So the only way to refetch is a new layer id, which drops the whole cache. The examples do just that: aef-mosaic uses id: `aef-zarr-layer-${yearIdx}` (App.tsx#L102), and dynamical-zarr-ecmwf uses id: `ecmwf-zarr-layer-${initTimeIdx}` (App.tsx#L222).
ZarrLayer's comment recommends updateTriggers: { renderTile: [selection] } to invalidate cached tiles when selection changes (zarr-layer.ts#L368-L373). But renderTile only rebuilds a cached tile's layers from its cached data, which was fetched for the old selection.
MosaicLayer has the same gap for getSource, which its inner getTileData calls (mosaic-layer.ts#L262-L278).
This follows from the code. I haven't reproduced it in an app.
2. MosaicLayer's renderSource trigger works by accident
A trigger change makes MosaicLayer render again. Each render defines a new MosaicTileset2DFactory (#L241-L245), so the inner TileLayer sees a changed TilesetClass and rebuilds the layers of every loaded source.
RasterTileLayer relies on the same mechanism on purpose, and says so in a comment (#734). MosaicLayer doesn't. Moving its class out of the method would silently stop renderSource triggers from reaching the sources already loaded.
3. updateTriggers.all doesn't reach the inner TileLayer
deck.gl passes all down to every sublayer built with getSubLayerProps (composite-layer.ts#L215-L217). Neither layer builds its TileLayer that way.
Proposed fix
-
In
RasterTileLayer, passupdateTriggers.getTileDataandupdateTriggers.allon to the innerTileLayer, beside the existingrenderTile→renderSubLayers.COGLayerandZarrLayerinherit that, andZarrLayer's comment can then recommendgetTileData: [selection]. -
In
MosaicLayer, mapgetSource→getTileDataandrenderSource→renderSubLayers, and passall.- Building both inner
TileLayers fromthis.getSubLayerProps(...), as deck.gl'sTerrainLayerdoes (terrain-layer.ts#L364-L365), would passallalong with the base props that #784 is about.
- Building both inner
-
Document the triggers in one place:
Layer Trigger Effect RasterTileLayer,COGLayer,ZarrLayerrenderTileRebuilds loaded tiles from their cached data, without fetching getTileDataRefetches every tile MosaicLayerrenderSourceRebuilds loaded sources from their cached data, without fetching getSourceRefetches every source All of them allRefetches and rebuilds everything A change to a non-function prop already rebuilds loaded tiles (the per-render class, #734), so it needs no trigger.
-
Add tests with
@deck.gl/test-utils:- a
renderTileorrenderSourcetrigger rebuilds a loaded tile without fetching; - a
getTileDataorgetSourcetrigger refetches it; alldoes both;opacityreaches a loaded tile (#784).
These tests would also make #710's stable class safe to try later.
- a
Related: #453 (closed by #462, which added the renderTile mapping), #710, #734, #784.
🤖 Written by Claude Code
- Dominant language
- TypeScript
- Stars
- 231
- Forks
- 34
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 75
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from developmentseed/deck.gl-raster
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
developmentseed/deck.gl-raster#798 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
developmentseed/deck.gl-raster#589 ·
Maintainers usually reply within 1 day
-
Add zarr-globe examplePossibly taken @kylebarron claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
developmentseed/deck.gl-raster#568 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
developmentseed/deck.gl-raster#814 ·
Maintainers usually reply within 1 day
-
zarr
Difficulty 4/5 3-5 days Newbie friendliness 38/100
developmentseed/deck.gl-raster#813 ·
Maintainers usually reply within 1 day
All issues in developmentseed/deck.gl-raster
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
scaleway/ultraviolet#7089 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
tencent-connect/dsh-qqbot#81 ·
Maintainers usually reply within 1 day
-
[Bug]: Pen taps on sidebar rows start a drag and lose their clickPossibly taken @makhnatkin claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
clangd/vscode-clangd#1009 ·