visgl / react-google-maps

React components and hooks for the Google Maps JavaScript API
https://visgl.github.io/react-google-maps/
MIT License
1.3k stars 109 forks source link

[Bug] CollisionBehavior and conditional rendering for AdvancedMarker #449

Open soszik opened 4 months ago

soszik commented 4 months ago

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 && ` 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

Logs

No response

usefulthink commented 3 months ago

Unfortunately, this is an issue in the maps API, I filed an issue here: https://issuetracker.google.com/issues/356896467