-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad practice in OverlayView #817
Comments
I've noticed the OverlayView having particularly bad performance as well. Works fine with the native google maps, but the same number of OverlayViews in this component results in drastically poor performance. |
@zolero Great hint thanks. The performance of my map drastically increased just by moving the appenChild in the onAdd function. However I'm facing some issues in moving the unstable_renderSubtreeIntoContainer in the render function. How did you manage to do this? Thanks a lot. |
@molimauro We had rewrite it to TypeScript, and updating it frequently: https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api You can see our docs: https://react-google-maps-api-docs.netlify.com/ Also a lot of examples: https://react-google-maps-api-gatsby-demo.netlify.com/ https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api-gatsby-example/src/examples The bundle size is much smaller: https://bundlephobia.com/result?p=@react-google-maps/api Enjoy! |
@JustFly1984 Yeah I'm aware of it (thanks for your work) and I'm planning the switch in the future, now unfortunately I can't. |
Really bad practice in the OverlayView component for performance reasons. Why?
In the draw method every map movement it will re-append the this.containerElement and re-render the react component.
The appendChild() function should be in onAdd() and the unstable_renderSubtreeIntoContainer() function should be in render() method of the React Component.
This resulted in a huge performance different on our projects. Maybe someone could change this class so everyone can enjoy of the performance boost! I'm having issues to create a pull request because of styling problems.
For more information: https://developers.google.com/maps/documentation/javascript/customoverlays
react-google-maps/src/macros/OverlayView.jsx
Lines 89 to 106 in ca5c5c6
The text was updated successfully, but these errors were encountered: