Skip to content
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

Fix: if center changed before google map api was finished, map center will keep as the previous center #1205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sspku-yqLiu
Copy link

hi Google map react team.

We faced an issue during use google map react. If api from https://maps.googleapis.com is very slow, and we change map center before google map api return data. map may cannot detect the center change and will not move the center to the correct place.

Steps to reproduce:

  • use Default center, lets say center of singapore as the fallback location of my address
  • fetch data from https://maps.googleapis.com and https://www.getMyHomeAddress.com
  • https://www.getMyHomeAddress.com return value first
  • change the pin and center value to the api data. and for now, we cannot find this.map_, which mean we will skip the panTo function
  • https://www.getMyHomeAddress.com return value
  • since the prevProps center is already changed to my home, so it wont trigger panTo function also
  • google map will show the center as the fall back address

Plans for solve the problem:

  • add a state initializedCenter_ to force trigger panTo function when map is shown

@sspku-yqLiu sspku-yqLiu changed the title Fix: map center wont change before map api is loaded Fix: if center changed before google map api was finished, map center will keep as the previous center Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant