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

Go back from settings to location / edit location / review / map #545

Merged
merged 3 commits into from
Nov 10, 2024

Conversation

wbazant
Copy link
Collaborator

@wbazant wbazant commented Oct 27, 2024

Closes #484

@ezwelty
Copy link
Collaborator

ezwelty commented Oct 31, 2024

@wbazant Good catch with the edit-review behavior. The problems raised in the issue are fixed, except for my "perhaps related" note:

Clicking on a location while settings is open, then clicking back on location does not go back to settings as one might expect, but to the default map view.

Is this something worth also addressing in this PR?

@wbazant
Copy link
Collaborator Author

wbazant commented Oct 31, 2024

Is this something worth also addressing

It felt like a small feature but I did it! Going to settings sets fromSettings true in the location slice, going away anywhere but location page resets it, and going on location page preserves the current value. Then the back button on location page takes you to either settings or map - so, going between different locations or panning the map is lumped together for what counts as 'back'

Copy link
Collaborator

@ezwelty ezwelty left a comment

Choose a reason for hiding this comment

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

  • An infinite loop is now possible: click on a location, then on settings. Clicking "<- Back" goes to location, clicking "<- Back" again to settings, and so on forever.
  • Much more minor, but going to review location, to settings, and "<- Back" returns to the bare location page rather than the #review anchor on the location page.

opening location page through back button shouldn't count
because then we have an infinite loop
@wbazant
Copy link
Collaborator Author

wbazant commented Nov 10, 2024

An infinite loop is now possible: click on a location, then on settings. Clicking "<- Back" goes to location, clicking "<- Back" again to settings, and so on forever.

Fixed, thanks for spotting! I forgot you can 'go to the location' through the back button. Now we only set isFromSettings when clicking on the map when the URL is /settings, and we reset it only when going away from a location page, with this funny looking code in src/components/connect/ConnectLocation.js:

+  useEffect(
+    () => () => {
+      dispatch(setFromSettings(false))
+    },
+    [dispatch, locationId],
+  )

Much more minor, but going to review location, to settings, and "<- Back" returns to the bare location page rather than the #review anchor on the location page.

That is a minor issue :) . I don't have a way to fix it that feels worthwhile, unless we take it as a sign that we should be restoring scrollbar position on 'back from settings' always, or that the review form on desktop should actually be its own page like on mobile instead of under the location?

@wbazant wbazant requested a review from ezwelty November 10, 2024 15:02
@ezwelty
Copy link
Collaborator

ezwelty commented Nov 10, 2024

should actually be its own page like on mobile instead of under the location?

I think this. It always felt cluttered to me to have the form just dangling there at the bottom.

Copy link
Collaborator

@ezwelty ezwelty left a comment

Choose a reason for hiding this comment

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

@wbazant I confirm the infinite loop is fixed. Thanks!

I did notice during use and testing that the navigation with the browser's back button is sometimes surprising. I'll see if I can coherently describe that in a future issue. Coming from the simple and innocent world of the server-side-rendered Rails website, navigation and routing is one of the aspects of the new website I have the most trouble wrapping my head around.

@ezwelty ezwelty merged commit 7dfebf0 into falling-fruit:main Nov 10, 2024
1 check 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.

Unexpected back behavior in settings
2 participants