mapbox / mapbox/mapbox-gl-js

GeoJSON is flickering when using feature state

Open
#11,643 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

The GeoJSON layer is redrawn multiple times during map zooming when using the feature state, causing flickering. Disabling the feature state in the layer paint properties seems to fix the flickering.

**mapbox-gl-js version**: 2.8.0-beta.1

**browser**: Google Chrome 99.0.4844.84, Firefox 98.0.2, Safari 15.4

### Steps to Trigger Behavior

1. Open [`debug/featurestate.html`](https://github.com/mapbox/mapbox-gl-js/blob/c3ceef9222d54e585661ff16503ad4589075fb9a/debug/featurestate.html) example in the browser
2. Try to zoom in on different locations
3. You'll see that the GeoJSON layer is sometimes redrawn twice, causing flickering

https://user-images.githubusercontent.com/533564/160382109-3046cd71-5497-45fa-b949-4348ca095773.mov

### Expected Behavior

The GeoJSON layer is not redrawn twice.

### Actual Behavior

The GeoJSON layer is sometimes redrawn twice, causing flickering.

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 debug/featurestate.html and reproduce the flicker while zooming with feature state enabled. Compare behavior when feature state is removed from the layer paint properties, then trace the redraw path involved in the example. Done means the GeoJSON layer is not redrawn twice during zooming in Chrome, Firefox, and Safari.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.