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 panning issues related resource info modal #539

Merged
merged 12 commits into from
Oct 15, 2024

Conversation

ravicodelabs
Copy link
Contributor

@ravicodelabs ravicodelabs commented Oct 6, 2024

Change Summary

Addresses #527. Introduces lastResourcePan in redux state to supersede prior mapCenter in redux, and currentLat/currentLon component state in <ReactGoogleMaps>, which helps properly track the last pan caused by the user clicking a pin or on the "Near Me" button.

Change Reason

Fixes various issues as described in detail in issue #527, where the map was panning when it shouldn't be, and wasn't panning when it should be, depending on the scenario.

Related Issue: #527

This fixes the issue where opening a site, then clicking "Near Me", then
closing the info modal was panning back to the prior site, whereas it
should have stayed at the "Near Me" site. This is "issue C" as discussed
in the comments of GitHub issue #527.
The name change reflects the fact that currently as a user may have
panned around the map by clicking and dragging the map, the `mapCenter`
state was not updated. Instead, the state is updated when e.g. a pin
is clicked, or the "Near Me" button is clicked.
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.

Overall, the changes look good and I was able to retest with your detailed steps, thanks again for writing them! 😄

I only found one small detail to address before approving

@@ -129,7 +130,7 @@ export default (state = initialState, act) => {
: {
...state,
selectedPlace: state.allResources[act.selectedPlace],
showingInfoWindow: true
showingInfoWindow: true // debuggin! why is this here, and not in the other branch?
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking, does this comment still need to be addressed or can it be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack (no pun intended!) Thanks for catching this, it was a self-comment while I was working, which has now been removed.

To clarify, by "branch" I meant the if branch in filterReducers, which did not set the selected place, while the else branch did. After a bit more digging, I could not find any instance where we are actually using the resource ID to set the place, hence the if-else seemed unnecessary, removing it altogether removed the need to worry about setting the selected place in both branches.

TL;DR - I have removed the if-else and that comment in the reducer, and also transitioned to the createAction syntax as part of the recent guidelines. Also, some of the commit changes are being caused by prettier formatting, sorry for any confusion!

Removed unnecessary if-else condition from the reducer, and
transitioned to the `createAction` syntax.
@ravicodelabs
Copy link
Contributor Author

I believe your last comment was addressed. Please let me know if I've missed anything!

@gcardonag
Copy link
Contributor

I believe your last comment was addressed. Please let me know if I've missed anything!

Nope, your change makes sense! I'm thinking the check for typeof in the old SET_SELECTED_PLACE action was tied to code that is no longer in-place today, so removing it makes sense.

@gcardonag gcardonag merged commit 2116382 into develop Oct 15, 2024
2 of 4 checks passed
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.

2 participants