You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clicking on infowindow and then back to map rerenders markers. #269
this project does not use react very well. the authors wrote this so they could market their book. ironically marketed by saying "learn react the right way"
Use shouldComponentUpdate() to let React know if a component’s output is not affected by the current change in state or props. The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior.
Reacted by Gaurav Harchwani, Michael Pintos, Nickson Thanda, Jan Grz, Radin Reth, Fredrik A. Madsen-Malmo and Jacks
@Qwiso do you know any other library which doesn't requires too much setup... I did tried using should ComponentUpdate but too much of if statements and still for one case I am unable to handle the update.... This updating thing should be part of core module only then it will work in all scenarios. Would be great if you can tell me any other library.
even if I update other state variables on the screen/component which are not used for map component also rerendering the map component. This should not be expected behaviour does anyone know how to fix it ?
To solve this issue of re-rendering and to allow for editing of SVG data which is mentioned in other issues, I implemented a new property in Marker.js and changed the logic of the componentDidUpdate method
@themakerman it's just the part of the source code that i've changed. Marker.js from google-maps-react module. that what it looks like. not sure if it's ES5
@srobertson421 , Your solution is pretty nice, but still forces me to pass property icon otherwise I will get error, so I do a little patch hope it helps:
@radinreth and @srobertson421 - sending many many blessings to your and your family and your cousin and friends. I couldn't knock it and your code works beautifully.
Activity
Qwiso commentedon Oct 15, 2018
this project does not use react very well. the authors wrote this so they could market their book. ironically marketed by saying "learn react the right way"
https://reactjs.org/docs/react-component.html#shouldcomponentupdate
Use shouldComponentUpdate() to let React know if a component’s output is not affected by the current change in state or props. The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior.themakerman commentedon Oct 15, 2018
@Qwiso do you know any other library which doesn't requires too much setup... I did tried using should ComponentUpdate but too much of if statements and still for one case I am unable to handle the update.... This updating thing should be part of core module only then it will work in all scenarios. Would be great if you can tell me any other library.
kashifaliquazi commentedon Oct 16, 2018
even if I update other state variables on the screen/component which are not used for map component also rerendering the map component. This should not be expected behaviour does anyone know how to fix it ?
themakerman commentedon Oct 24, 2018
@kashifaliquazi yup it is happening. Mayb to keep mapview away from redux? Thats the only way i think to avoid rerendering
Qwiso commentedon Oct 24, 2018
To solve this issue of re-rendering and to allow for editing of SVG data which is mentioned in other issues, I implemented a new property in
Marker.jsand changed the logic of thecomponentDidUpdatemethodin the render method of my map view, I create each marker based on custom object I am using from the state
and finally,
themakerman commentedon Oct 25, 2018
@Qwiso
Is this ES5?
Qwiso commentedon Oct 25, 2018
@themakerman it's just the part of the source code that i've changed.
Marker.jsfrom google-maps-react module. that what it looks like. not sure if it's ES5themakerman commentedon Oct 26, 2018
@Qwiso Ohh i got it. You edited the module itself. Why not PR?
Qwiso commentedon Oct 26, 2018
@themakerman because, as written, it's a breaking change to the existing functionality. it's not a great way of doing things but it works for me
srobertson421 commentedon Jun 15, 2019
Extending the Marker component works in the meantime until the comparison fix is merged:
radinreth commentedon Aug 1, 2019
@srobertson421 , Your solution is pretty nice, but still forces me to pass property
iconotherwise I will get error, so I do a little patch hope it helps:sridaradappt commentedon May 8, 2020
When I use custom url for marker, it re renders the marker. Is there any solution to fix that ?
teadams commentedon Aug 31, 2020
@radinreth and @srobertson421 - sending many many blessings to your and your family and your cousin and friends. I couldn't knock it and your code works beautifully.
kevinvugts commentedon Jan 12, 2021
What is the status of this? Is it already integrated into the lib?
dannyVortexIoT commentedon Feb 4, 2021
@kevinvugts currently this is still the only workaround. This library isn't very well supported.