visgl / react-google-maps

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

[Bug] collisionBehavior, for whatever reason, isn't binding properly to the underlying AdvancedMarkerElement #569

Open bishoym opened 1 month ago

bishoym commented 1 month ago

Description

Every other prop seems to be binding properly, except collision behaviour.

Bizarre.

Steps to Reproduce

Here's the codesandbox demonstrating the problem: https://codesandbox.io/p/sandbox/google-maps-collision-marker-test-2fy8lg

You can see that creating the markers and binding collisionBehavior imperatively makes it work, while the wrapped React component doesn't.

Environment

Logs

No response

usefulthink commented 1 month ago

The first thing I noticed is that the property is named collisionBehavior, not collisionBehaviour (like the Maps JavaScript API, we use American English spelling in this library). Still, even with the correct name, it isn't working on the first render, which I will have to investigate.

mrMetalWood commented 1 month ago

It seems like this bug got introduced by the new anchor handling of our advanced markers. Your demo is working when using the 1.1.3 version of the library. That might be a quick fix for you until we can figure out how to best address this.

bishoym commented 3 weeks ago

Hey just wanted to give an update on this. I'm using the imperative approach until a fix is merged as that doesn't seem to have any downsides for my current use-case.

In the interim, if you think this is a good first issue I can try and jump in on the PR fixing this.

mrMetalWood commented 2 weeks ago

@bishoym We published 1.4.0 which should fix the issue. Can you check if this solves your issues?