Uh oh!
There was an error while loading. Please reload this page.
fix markers rerender when click to open InfoWindow - #310
Conversation
m-bartenev
commented
May 25, 2019
@deadkff01 , I came across that issue recently. I did the same comparison but in shouldComponentUpdate method. Can I ask you why you've opted to the componentDidUpdate? |
deadkff01
commented
May 26, 2019
@m-bartenev, I did the comparison in |
m-bartenev
commented
May 26, 2019
@deadkff01 , I see :) Thank you for your answer! |
srobertson421
commented
Jun 15, 2019
To anyone who comes across this bug, here is a patch you can use until things are merged, should stop the constant re-renders: |
deadkff01
commented
Aug 6, 2019
Nice @srobertson421 |
| componentDidUpdate(prevProps) { | ||
| if ((this.props.map !== prevProps.map) || | ||
| (this.props.position !== prevProps.position) || | ||
| ((this.props.position && prevProps.position) |
There was a problem hiding this comment.
most unreadable, please rather use a function such as 'arePositionsEqual' to simplify readability. thank you
There was a problem hiding this comment.
Ok, it's been a long time, I'll see if this change still makes sense, if so, I'll make the change later.
Thanks for the feedback.
There was a problem hiding this comment.
The problem still persists in the current version of the lib.
I solved your issue in the last commits.
Solving issue #269
In Marker.js componentDidUpdate()
this.props.positionandprevProps.positionwill never be equal after component is fully rendered in first time, because these properties are objects, for this reason I use thelatandlngto compare after the first rendering.