google-map-react: X of undefined on mouse enter / move on map
Using v1.1.0
Whenever I include even the simplest marker on the map I get this error when the mouse enters the map:
Uncaught TypeError: Cannot read property 'x' of undefined
I’m not sure if it’s actually directly breaking anything because the markers still show up, but I could see it causing other wierd behavoir maybe. I’m ‘assuming’ that this error is related to the “Internal Hover Algorithm”. But this is just a guess.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 19 (2 by maintainers)
Commits related to this issue
- Added empty object check to onMouseChangeHandlerRaf on GoogleMapMarkers component (Issue #677) — committed to kumiau/google-map-react by kumiau 4 years ago
- Disabled react strict mode as it causes problems with google maps component https://github.com/google-map-react/google-map-react/issues/677 — committed to opencommunitymap/communitymap-ui by dmitry-yudakov 4 years ago
This still happens with basic example on Github
This is also happening to me, the error message is different though
It happens when implementing the basic example of github, if you remove the markers the error goes away.
I would not consider this issue as solved. The issue still happens when using Async React (
^16.10.1
) and I cannot toggle<Suspense>
in my project, as each route is loaded asynchronously.App.tsx
RootRouter.tsx
:IndexScreen.tsx
:I am getting the following errors:
@CodeWitchBella I tested it with and without strict mode and it behaved the same, toggling suspense however, did the trick!
I figured it out.
So, the jiggling issue only happens if you wrap the map in <Suspense />,
Removing Suspense, solves the issue.
ALSO: The issue is fully fixed as of
"react": "^16.9.0",
Apparently there was a bug in Suspense that was fixed by the react team.
@Umbrellagun Try this out! I am almost sure it’ll solve your issue as well
It works for me, removing StrinctMode in index.js
For me this only occurs in StrictMode
@Umbrellagun I have the same issue, Did you figure out a work around maybe? 🤔 Thanks!
@Bartozzz Hey! Can you show me your index file? How do you mount the App to the dom?
I had issues when I usead
UNSAFE_createRoot
but now that I simply use the way below, it works fineLet me know if i can provide further help!
Issue is still present in v1.14
I was finally able to poke this again and I discovered that even just leaving an empty function in place of the distanceToMouse prop you mentioned @A-Tokyo appears to prevent the error from showing. I don’t need this function as far as I know, so it may not be a solution for anyone that is using this, but I just thought it might be helpful to note.
distanceToMouse={()=>{}}
edited: This is working for me in a WordPress/Gutenberg environment, no Async React
@A-Tokyo Not yet, no. I’ll let you know if I get to it though!