Skip to content

perf(SF2.0): Dynamically load trip details on expand#3124

Draft
joshlarson wants to merge 11 commits intomainfrom
jdl/sf2.0/separate-trip-details-from-upcoming-departures
Draft

perf(SF2.0): Dynamically load trip details on expand#3124
joshlarson wants to merge 11 commits intomainfrom
jdl/sf2.0/separate-trip-details-from-upcoming-departures

Conversation

@joshlarson
Copy link
Copy Markdown
Contributor

Scope

Asana Ticket: 📅🔎🎭 Improve SF2.0 performance

Implementation

  • Add a handler to the LiveView that loads trip details into the socket when their associated row is expanded.
  • Lift all upcoming-departures related fields (that is, fields that are visible when upcoming departures rows are collapsed) to the UpcomingDepartures struct.
  • Remove trip_details from UpcomingDepartures, in favor of calculating that out of band (on expand).
  • Reduce the scope of Schedules.Repo queries to avoid iterating over as many %Schedule{} structs.

Screenshots

Screenshot 2026-04-17 at 3 08 02 PM

This is a mostly invisible change (except that hopefully things will load faster!) This state is kind of the exception - it's not possible to see a loading spinner in that spot on main right now.

How to test

The real test is to deploy this to dev-{green,blue}, and compare CPU utilization between dev-{green,blue} and dev-{blue,green} while having like 20 SF2.0 tabs open.

@lvachon1
Copy link
Copy Markdown
Contributor

lvachon1 commented Apr 17, 2026

Screenshot 2026-04-17 at 4 25 15 PM

Certainly seems to help so far. 20 tabs on each, green never went above 50%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-green Deploy to dev-green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants