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 map snapback by cleaning up hooks #501

Merged
merged 3 commits into from
Aug 13, 2024
Merged

Fix map snapback by cleaning up hooks #501

merged 3 commits into from
Aug 13, 2024

Conversation

cjfit
Copy link
Collaborator

@cjfit cjfit commented Jul 24, 2024

Pull Request

Change Summary

Fixes the map snapping back to City Hall when browsing resources. Map will now follow user, including in the search feature.

Change Reason

Map snapping back to City Hall marks for a poor user experience when trying to browse resources on the map. It also conflicts with the panning behavior of the search functionality.

Verification [Optional]

phlask-500-480p.mov.zip

No new console errors:
Screen Shot 2024-07-23 at 8 41 04 PM

Fixes #500

@gcardonag
Copy link
Contributor

gcardonag commented Jul 24, 2024

Reviewing this on my phone so I'm a bit limited, but it looks like this would eliminate the map using the user's location to center the map where they are. Could you keep that functionality as a part of the fix? Users may just want to see options near them when browsing the map on their phones. It may be confusing to see city hall on the map when you're browsing from North Philly.

For some more context, we use City Hall as a default first location in the event users do not want to share their location.

@cjfit
Copy link
Collaborator Author

cjfit commented Jul 25, 2024

Thanks for the catch @gcardonag! I wasn't sure if the geolocation feature was implemented yet. The latest commit adds that back.

Copy link
Contributor

@RNR1 RNR1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions/suggestions

setCurrentLat(position.coords.latitude);
setCurrentLon(position.coords.longitude);
} catch (error) {
console.error("Error obtaining geolocation. Default coordinates will be used.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we noop this catch statement? We don't get much value from these console statements

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we yeet the catch, we'll get an unhandled GeolocationPositionError from getCoordinates. I removed the console statement in the latest commit though
Screen Shot 2024-08-11 at 7 59 16 PM

Copy link
Contributor

@gcardonag gcardonag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved since the logging message has been cleaned up and the rest of the code has been reviewed ✅

@gcardonag gcardonag merged commit 84c2adb into develop Aug 13, 2024
5 of 6 checks passed
@tomporvaz tomporvaz linked an issue Aug 21, 2024 that may be closed by this pull request
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.

Fix bug where map doesn't follow user. Avoid panning to user location in most cases
3 participants