visgl / visgl/react-map-gl

[Bug] Uncaught TypeError: Cannot read properties of undefined (reading 'key') with terrain

Open
#2,539 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.5k
Forks
1.4k
Avg merge
5d 17h
Merged PRs (30d)
3

Description

Description

I'm getting this error when I zoom or pan quickly and terrain is present in my style. I've tried setting maxTileCacheSize to 256 to no avail. Removing the terrain object from the style stops this from happening.
The terrain source is https://api.maptiler.com/tiles/terrain-rgb/tiles.json

framebuffer_error.ts:13 Uncaught TypeError: Cannot read properties of undefined (reading 'key')
    at be._updateRetainedTiles (source_cache.ts:750:1)
    at be.update (source_cache.ts:670:1)
    at bi._updateSources (style.ts:1654:1)
    at e.Map._render (map.ts:3291:1)
    at map.ts:3453:1
    at browser.ts:22:1
Expected Behavior

The app shouldn't crash while zooming or panning while rendering 3d features

Steps to Reproduce

I'm not able to provide a code sandbox atm

Environment
  • Framework version: react-map-gl@8.0.4
  • Map library: maplibre-gl@5.5.0
  • Browser: Chrome 135.0.7049.42
  • OS: MacOs
Logs

framebuffer_error.ts:13 Uncaught TypeError: Cannot read properties of undefined (reading 'key')
at be._updateRetainedTiles (source_cache.ts:750:1)
at be.update (source_cache.ts:670:1)
at bi._updateSources (style.ts:1654:1)
at e.Map._render (map.ts:3291:1)
at map.ts:3453:1
at browser.ts:22:1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing rapid zooming or panning with the terrain source https://api.maptiler.com/tiles/terrain-rgb/tiles.json, since no sandbox is provided. Read source_cache.ts around _updateRetainedTiles and update, then follow the callers in style.ts. Done means rendering terrain no longer throws the reported TypeError during navigation.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.