react-google-maps-api icon indicating copy to clipboard operation
react-google-maps-api copied to clipboard

MarkerClustererF isn't working properly in NextJS in Strict Mode

Open bartsam opened this issue 3 years ago • 9 comments

The render of MarkerClustererF isn't working properly with NextJs in strict mode. Sometime on rerender it appear until another render.

I made an exemple on codesandbox with a basic config : https://codesandbox.io/p/sandbox/serene-liskov-nu89s8?selection=%5B%7B%22endColumn%2[…]rcquy%2522%252C%2522isMinimized%2522%253Afalse%257D%255D%257D

Have you an idea of the problem ?

bartsam avatar Nov 25 '22 15:11 bartsam

Same issue here, updated to the newest api version but MarkerClustererF is still not working in strict mode. Also nextJs app.

Tillytaly avatar Nov 27 '22 13:11 Tillytaly

+1

Hilver avatar Dec 06 '22 08:12 Hilver

Same issue. if I use MarkerClusterer I can see the Markers with MarkerF but the are not clustering, but if I use MarkerClustererF the Markers disappear.

IsaacHatilima avatar Dec 16 '22 09:12 IsaacHatilima

A lot of things are broken with this module in strictmode, see also: https://github.com/JustFly1984/react-google-maps-api/issues/3095

klarstrup avatar Dec 16 '22 16:12 klarstrup

The same here, sometimes, not always clustering isn't working at all or isn't working properly. Properties: next.js, strict mode dynamic data for markers

andrikash avatar Dec 26 '22 09:12 andrikash

Running into the same issue with the same code as OP in Next 13 & React 18 Strict. The Clusterer class can be accessed in the callback for onLoad, it has the full array of markers to cluster but will not display them.

nathannye avatar Mar 01 '23 01:03 nathannye

reactStrictMode: false

Or you can also turn off strict mode for some pages (or rather turn it on where you want it)

https://nextjs.org/docs/api-reference/next.config.js/react-strict-mode https://beta.reactjs.org/reference/react/StrictMode#enabling-strict-mode-for-a-part-of-the-app

welschmoor avatar Mar 16 '23 08:03 welschmoor

reactStrictMode: false

https://nextjs.org/docs/api-reference/next.config.js/react-strict-mode

Obviously OP knows how to disable strict mode they had to enable it to produce this problem in the first place

It not working in strict mode means it might break fully in future react versions and is a sign of underlying problems with the implementation

Plus this also applies to react strict mode outside of Next.js

klarstrup avatar Mar 16 '23 08:03 klarstrup

Same issue +1

gundogduyakici avatar Sep 30 '23 18:09 gundogduyakici