visgl / visgl/react-google-maps
[Bug] CollisionBehavior and conditional rendering for AdvancedMarker
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 193
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 13
Description
Description
Hi,
I noticed unexpected behavior for Advanced Markers with collision behavior OPTIONAL_AND_HIDES_LOWER_PRIORITY.
<AdvancedMarker
key={id}
position={{ lat: latValue, lng: lngValue }}
zIndex={800}
collisionBehavior={CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY}
>
In my particular case I render an array of markers for when zoom is within given level (showMarkers is set to true)
showMarkers && <Markers>
When markers are not visible and then zoom changes to certain level and they should be rendered, at first ALL Markers are visible and after short amount of time (less than 1 s) the overlapping markers are hidden.
Expected behavior: only not-overlapping markers should be visible from the beginning.
Steps to Reproduce
Render array of Advanced Marker with CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY with optional rendering based on Boolean flag.
When they rendered after flag is set to true ALL markers are visible for max 1s, then overlapping markers disappear.
Environment
- Library version: 1.1.0
- Google maps version: weekly
- Browser and Version: Chrome 126.0.6478.127 (Official Build) (64-bit)
- OS: Windows 10
Logs
No response
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 conditional AdvancedMarker rendering described in the issue, using CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY and toggling the showMarkers flag after a zoom change. Observe the initial render and subsequent collision update; done means overlapping markers are hidden immediately when the markers appear, without the reported visible delay.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100