diff --git a/packages/deck.gl-geotiff/src/multi-cog-layer.ts b/packages/deck.gl-geotiff/src/multi-cog-layer.ts index 903df19b..03a825eb 100644 --- a/packages/deck.gl-geotiff/src/multi-cog-layer.ts +++ b/packages/deck.gl-geotiff/src/multi-cog-layer.ts @@ -307,8 +307,19 @@ export class MultiCOGLayer extends CompositeLayer { }); } - override updateState({ changeFlags }: UpdateParameters): void { - if (changeFlags.dataChanged || changeFlags.propsChanged) { + override updateState({ + changeFlags, + props, + oldProps, + }: UpdateParameters): void { + if (changeFlags.dataChanged || props.sources !== oldProps.sources) { + // Reset state so renderLayers() returns null while we re-open COGs. + // Without this, the TileLayer renders with new props but stale state, + // caching tiles with the wrong bands. + this.setState({ + sources: null, + multiDescriptor: null, + }); this._parseAllSources(); } } @@ -494,6 +505,10 @@ export class MultiCOGLayer extends CompositeLayer { 0, ); + console.log( + `Tile (${x}, ${y}, ${z}): fetched bands [${[...bands.keys()].join(", ")}], total byte length: ${byteLength}`, + ); + return { bands, forwardTransform,