[Bug] terrain prop does not reset to no-terrain when set to undefined

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

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Search the terrain prop update path and existing terrain-related tests or map component entry points. Reproduce the transition from a terrain value to undefined, then add coverage showing that the terrain setting is disabled without a TypeScript error; the issue is done when that regression passes.

Written by the indexing model from the issue text.

Description

bug
Description

Once terrain is enabled by something like terrain={source: 'terrain-dem', exaggeration: 1.5}; you can not disable it again by setting it to undefined. Setting is to null does work but throws a typescript error.

Expected Behavior

Typescript says terrain is terrain | undefined, so setting to undefined should disable terrain in maplibre.

Steps to Reproduce

Toggle terrain setting between terrain and undefined.

Environment
  • Framework version: 4.7.1 or 5.1.0
  • Browser: Chrome
  • OS: Mac
Logs

No response

Dominant language
TypeScript
Stars
8.5k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from visgl/react-map-gl

All issues in visgl/react-map-gl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.