visgl / visgl/react-map-gl

[Bug] Clustering example - onClick returning undefined

Open
#2,096 2 comments 2 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

The clustering example onClick function is returning undefined when clicking outside of clusters and on empty map space.

Expected Behavior

OnClick function to not return undefined.

Steps to Reproduce
  1. Go to react-map-gl clustering example: http://visgl.github.io/react-map-gl/examples/clusters
  2. Open up console
  3. Click on a specific point or any empty map space
  4. Notice error in console
Environment
  • Framework version: Current/latest from assuming examples are running on latest build
  • Map library: Current/latest from assuming examples are running on latest build
  • Browser: Chrome 108.0
  • OS: 13.1
Logs

Uncaught TypeError: Cannot read properties of undefined (reading 'properties')
at onClick (component---examples-clusters-src-app-tsx-ae435c98aa31b91df409.js:1:1591)
at Map._onPointerEvent (834b8338ea35f2c3d17eb82aef29032efb222d04-d473b88aba9c068a3050.js:1:20732)
at Map.fire (27-9fafbe3fd9a64912bea8.js:1:18842)
at t._fireEvent (834b8338ea35f2c3d17eb82aef29032efb222d04-d473b88aba9c068a3050.js:1:25834)
at Qr.click (27-9fafbe3fd9a64912bea8.js:1:813462)
at Rn.handleEvent (27-9fafbe3fd9a64912bea8.js:1:838674)

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 with the clustering example at https://visgl.github.io/react-map-gl/examples/clusters and reproduce the console error by clicking a point and empty map space. Inspect the example's onClick handler, then verify that clicks outside clusters no longer produce an undefined-property error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.