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

refactor: don't use anchor link in form action #2032

Merged
merged 1 commit into from
May 7, 2024

Conversation

thecristen
Copy link
Collaborator

@thecristen thecristen commented May 6, 2024

Summary of changes

Asana Ticket: Trip planner 500 error

Rendering the trip planner results requires parsing the form's selections via query params. We had a bug where, when specific modes are requested, the selected modes were not being resolved as query params cleanly because of our use of an anchor link (we send users to a certain spot in the DOM by appending #plan_result_focus to the URL), so we'd end up with this as the mode:

%{
  "bus" => "true",
  "commuter_rail" => "true",
  "ferry" => "true#plan_result_focus",
  "subway" => "true"
}

I decided to take an alternate approach and abstain from using an anchor link in this case. Here we use a tiny bit of JS to scroll to the trip planner result. I wanted to use JS.dispatch (which supposedly works on dead views) but could not get it to work properly; perhaps that'll work better in more up-to-date Phoenix/LiveView versions.

@thecristen thecristen marked this pull request as ready for review May 6, 2024 17:42
@thecristen thecristen requested a review from a team as a code owner May 6, 2024 17:42
@thecristen thecristen requested a review from anthonyshull May 6, 2024 17:42
@thecristen thecristen merged commit fd9adcd into main May 7, 2024
26 checks passed
@thecristen thecristen deleted the trip-plan-query-param-fix branch May 7, 2024 14:36
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