phlask / phlask-map

Code behind the Phlask Web Map
https://beta.phlask.me
34 stars 36 forks source link

Fix bug where map doesn't follow user. #500

Closed cjfit closed 3 months ago

cjfit commented 4 months ago

Describe the bug The map at beta.phlask.me does not follow the user, resulting in a subpar experience. If you click on a resource then close it, your viewport is set back to City Hall. This also happens in the search functionality to a smaller degree, where you're set back to the search pin.

I think this is a bug because there are multiple conflicting statements in the useEffect hook in ReactGoogleMaps.js and the initialCenter and center params in the Map component.

To Reproduce Steps to reproduce the behavior:

  1. Go to the map
  2. Click on any given resource away from City Hall
  3. Click off the resource or close the pop-up
  4. See the map reset your viewport to City Hall

Expected behavior If the user closes out of a resource or taps away from the resource pop-up, the map should stay at the location of the last viewed resource.

Occurs on mobile & desktop.

Additional context Add any other context about the problem here.