Skip to content

fix(ScheduleFinderLive): handle empty departures#3079

Merged
thecristen merged 1 commit intomainfrom
cbj/last-trip-time-fix
Apr 2, 2026
Merged

fix(ScheduleFinderLive): handle empty departures#3079
thecristen merged 1 commit intomainfrom
cbj/last-trip-time-fix

Conversation

@thecristen
Copy link
Copy Markdown
Collaborator

Scope

Found this bug after I did some load testing; it's an edge case which happens when going outbound from a terminus (e.g. Southbound from the southernmost stop), which is a situation which has no departures.

** (BadMapError) expected a map, got:
   nil
   (elixir 1.19.5) lib/map.ex:541: Map.get(nil, :time, nil)
   (dotcom 0.0.1) lib/dotcom_web/live/schedule_finder_live.ex:363: anonymous fn/4 in DotcomWeb.ScheduleFinderLive.assign_last_trip_time/1
   (phoenix_live_view 1.1.26) lib/phoenix_live_view/async.ex:141: anonymous fn/2 in Phoenix.LiveView.Async.assign_async/4
   (phoenix_live_view 1.1.26) lib/phoenix_live_view/async.ex:289: Phoenix.LiveView.Async.do_async/5
   (elixir 1.19.5) lib/task/supervised.ex:105: Task.Supervised.invoke_mfa/2
   Function: #Function<7.55729389/0 in Phoenix.LiveView.Async.run_async_task/

Implementation

I gave it a map like it wanted.

How to test

Was easy to find this bug at the "wrong" direction from termini, e.g. Green Line towards Riverside from the Riverside stop.

@thecristen thecristen requested a review from a team as a code owner April 2, 2026 20:37
@thecristen thecristen requested a review from jlucytan April 2, 2026 20:37
Copy link
Copy Markdown
Contributor

@jlucytan jlucytan left a comment

Choose a reason for hiding this comment

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

lgtm, great catch!

@thecristen thecristen merged commit 46cdf15 into main Apr 2, 2026
26 checks passed
@thecristen thecristen deleted the cbj/last-trip-time-fix branch April 2, 2026 20:44
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