Adding vector layer to map with map.addLayer will not always make the layer visible until next navigation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**:v3.7.0
**browser**:chrome
### Steps to Trigger Behavior
This does not always happen, it seems to be more likely to happen if the layer has lots of features.
It seems to be even more likely to happen if another layer with lots of features are already added to the map, so this is what I will based the repro steps on.
1. Add source used by layer A, alyways a url to an xyz tileset
2. Add layer A
3. Add source used by layer B, alyways a url to an xyz tileset
4. Add layer B
5. Notice that layer A is still visible, but layer B is not.
6. Move the camera
7. Notice that layer A and layer B is visible.
I have managed to work around the issue by popping a panBy[0,0] at the first idle event from the map. Popping it directly after adding the layer has no effect.
### Expected Behavior
I expect to see all layers added to the map
### Actual Behavior
Some layers does not show until after navigation
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the listed map.addLayer sequence, especially large XYZ tile layers, and observe the idle and panBy([0,0]) behavior. Trace the map.addLayer and rendering lifecycle to determine why the second layer waits for navigation; done means newly added layers are visible without moving the camera.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- computer-graphics, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100