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
Markers dissapear after refresh #3048
Comments
@SimeriaIonut import MarkerF instead of Marker |
Thanks, will do. Is there a reason for using MarkerF instead of Marker? |
yes. MarkerF is functional component vs class based Marker component, which does not work with react Strict and/or react@17+ |
Looks like MarkerClusterer has the same issue, but is not solved by using the MarkerClustererF version. |
I also faced the same issue. After using MarkerF component instead of Marker component it's working on my web application. |
thank you. you have saved me hours! |
This took me a few hours to find, but this is the correct answer. I had a project with a sample repo that was using Next 12 and React 17, then I went to create my own project using Removing |
I was trying two the days to fix that issue, thank you! |
Hi, I'm facing the same issue and using I've solved it, but the problem is that is a memoized Component, so if I try to use the "icon" prop in order to use a custom Marker icon and I want to dinamically change it's fillColor, the memoized component (MarkerF) does not work as expected. The same example works just fine using , but refresing the page all the markers disappear. |
Hello, I'm facing the same issue as @ezejerez. the MarkerF component no longer rerenders when I change the properties of the 'icon' prop. Is there a fix for this? |
I've the same problem. I tried using MarkerF and MarkerClustererF, but is not working - after a few refreshes / hard refresh I can't see the markers. This is happening just in dev mode, In production mode I can't reproduce. |
I really don't understand the reason behind removing reactStrictMode but it worked. The map shows even after refresh. |
Your Environment
os: MacOS
node --version: v14.19.3
react version: 18.1.0
webpack version: N/A
@babel version: N/A
@react-google-maps/api version: 2.12.0
How does it behave?
The marker dissapears after page refresh.
How should it behave correctly?
The marker should not dissapear after page refresh
Basic implementation of incorrect behavior in codesandbox.com
https://codesandbox.io/s/react-google-maps-api-issue-7meur1
The text was updated successfully, but these errors were encountered: