Skip to content

fix(deck.gl-geotiff): call MosaicLayer's onSourceError when getSource rejects - #860

Merged
kylebarron merged 2 commits into
mainfrom
kyle/mosaic-on-source-error
Nov 6, 2026
Merged

kylebarron merged 2 commits into
mainfrom
kyle/mosaic-on-source-error

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

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

MosaicLayer's onSourceError was never called. deck.gl's TileLayer passes its onTileError only the error, not the tile (this.props.onTileError(error) in 9.4.0 and 9.4.1). MosaicLayer's handler returned early when it had no tile, so it never reached the item.

Changes

  • getTileData catches a rejected getSource, calls onSourceError(item, { error }), and rethrows, so deck.gl still records the item as failed. It skips aborted opens, as deck.gl skips the callbacks of a cancelled tile.
  • When onSourceError is supplied, onTileError is a no-op, so deck.gl doesn't also log the error to the console. Supplying it already did that before.
  • The prop's docs say that an aborted open isn't reported and that supplying the prop stops the log.

Tests

Two LayerManager tests in "MosaicLayer with an item whose source fails to open":

  • "passes the item and the error to onSourceError, without logging": item B's getSource rejects. onSourceError gets B: Not found, and console.error isn't called. On main it fails with expected [] to deeply equal [ 'B: Not found' ].
  • "doesn't call onSourceError for an open aborted by removing the layer": getSource rejects with the abort's reason, as fetch does. Removing the layer aborts the open, and onSourceError isn't called. The test also checks that the abort happened, so it can't pass without one.

Mutation checks: reporting aborted opens too fails the second test, and dropping the no-op onTileError fails the first (console.error is called once).

The deck.gl-geotiff tests (224), pnpm -r --filter='!docs' typecheck and Biome pass.

🤖 Written by Claude Code

kylebarron and others added 2 commits November 6, 2026 11:48
… rejects

deck.gl's TileLayer passes onTileError only the error, so the handler that
mapped it to an item never ran. getTileData now reports the failure itself,
skipping aborted opens as deck.gl does, and onTileError stays a no-op so
deck.gl doesn't also log it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
mockRestore clears the recorded calls, so the assertion after it could not
fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kylebarron kylebarron added this to the 0.10 milestone Nov 6, 2026
@github-actions github-actions Bot added the fix label Nov 6, 2026

@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 aa3735d into main Nov 6, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/mosaic-on-source-error branch November 6, 2026 16:54
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