Closed Dastari closed 2 years ago
Hi, I have the same problem, have you fixed it? Its very annoying
The problem appears to be caused by Automatic Batching. In the React v18 documentation it says that you can use flushSync to opt-out of Automatic Batching however I don't believe this is entirely correct as Automatic Batching still happens, you can just force a re-render when you want to.
I have attempted many variations of using flushSync using @sud977 approach in the google-maps-react thread, however the same issue occurs.
Hi, I have the same problem too.
I am also having the same issue
Same problem here
@Dastari how can I apply this workaround in next js ?
use eslint with eslint plugins react react-hooks react-perf to reduce re-renders!
@JustFly1984 What do you mean? Apparently there is an issue with react 18 and the overlayview is flickering!! We can't upgrade to react 18 because of this issue.
@Dastari @manelio @asdutoit @becerriljc @nicolasperalta-endava
Same problem happening to me
I'm having the same issue when dragEnd in react-google-maps, the pins flickering, using the onDragEnd property you could set the lat and the lng again and recenter where you want to recenter the map.
Same Issue!
Still getting this issue
This is happening with me too. ~250 polygon features for countries on a world map and they all flicker every zoom in/out. I've confirmed this is not caused by re-renders of the map component by using the React profiler. Using react v18.2.0.
I had the same problem when using the OverlayView
component. However replacing it with OverlayViewF
, which is also exported from @react-google-maps/api
resolved the issue for me. Just thought this might help someone else too.
I had the same problem when using the
OverlayView
component. However replacing it withOverlayViewF
, which is also exported from@react-google-maps/api
resolved the issue for me. Just thought this might help someone else too.
This worked for me. Thanks a lot.
We are slowly but surely implementing F versions of each component. You can look at the progress in CHANGELOG.md React@18 StrictMode doesn't work with old class based components. After all components will have F versions, I',m gonna move class based components out of the main package into separate legacy package, which will be out of maintaining, to reduce main package bundle size.
I had the same problem when using the
OverlayView
component. However replacing it withOverlayViewF
, which is also exported from@react-google-maps/api
resolved the issue for me. Just thought this might help someone else too.
Thanks!!! this also worked for me!!!
Same problem happening to me... but my problem solved... how ( reactStrictMode is false form next.config.js then problem solved...all maps r proper working)
I had the same problem when using the
OverlayView
component. However replacing it withOverlayViewF
, which is also exported from@react-google-maps/api
resolved the issue for me. Just thought this might help someone else too.
Thanks, this worked fine for me!
I had the same problem when using the
OverlayView
component. However replacing it withOverlayViewF
, which is also exported from@react-google-maps/api
resolved the issue for me. Just thought this might help someone else too.
Bro, you're a life saver, this solution was just what i needed, Thank you so much!
I had the same problem when using the
OverlayView
component. However replacing it withOverlayViewF
, which is also exported from@react-google-maps/api
resolved the issue for me. Just thought this might help someone else too.
Thank you, your solution works
This worked for me as well. The documentation ought to be updated to reflect it.
I had the same problem when using the
OverlayView
component. However replacing it withOverlayViewF
, which is also exported from@react-google-maps/api
resolved the issue for me. Just thought this might help someone else too.
Thank you 🙏
This is happening with me too. ~250 polygon features for countries on a world map and they all flicker every zoom in/out. I've confirmed this is not caused by re-renders of the map component by using the React profiler. Using react v18.2.0.
@QLeitz Did you find any solution ?
Divide everything in smallest components, wrap all exports with memo, use useMemo and useCallback everywhere.
There is the fix for this, just use patching the change for your code https://github.com/google-map-react/google-map-react/pull/1224
When using the new createRoot render method in React 18 any components in the OverlayView will flicker and jump when panning the map.
Additionally the OverlayView components will not render on initial render (causing a re-render will trigger them to show)
@react-google-maps/api:v2.11.9 react:18.0
Repo to demonstrate using createRoot (note you have to change the number of rendered dots for it to trigger a re-render):
https://codesandbox.io/s/react-maps-api-overlay-v18-yqsfil
Repo showing it working when returning to the old v17 render method:
https://codesandbox.io/s/react-maps-api-overlay-v17-4qt0pl