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

feat: Added route ladders to new minimal ladders page #2583

Merged
merged 5 commits into from
May 8, 2024

Conversation

hannahpurcell
Copy link
Collaborator

Asana Ticket: https://app.asana.com/0/1205385723132845/1207162343766763

I lowered some logic from the LadderPage into the RouteLadders component to avoid stubbing out identical logic in MinimalLadderPage. Does that seem rational?

Also, is this PR too big?

@hannahpurcell hannahpurcell requested a review from a team as a code owner May 6, 2024 21:02
Copy link

github-actions bot commented May 6, 2024

Coverage of commit 9214c7f

Summary coverage rate:
  lines......: 93.9% (3234 of 3443 lines)
  functions..: 73.4% (1337 of 1822 functions)
  branches...: no data found

Files changed coverage rate: n/a

Download coverage report

@@ -52,7 +52,9 @@ export const AppRoutes = () => {
}, [path, setPath])

const vehiclesByRouteIdNeeded =
openView === OpenView.Late || location.pathname === "/"
openView === OpenView.Late ||
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems kind of brittle (it was before too, but now that there are three conditions, it seems especially so), but I don't have any great ideas for how to de-brittle-ify it. I wish there was some way that the view itself could tell app "I need vehiclesByRouteId".

Possibly having useVehicles be called within the page components themselves? I had a thought that that wouldn't be possible because of the socket, but the socket should be accessible within the page components by way of useContext.

This is a non-blocking comment, and probably shouldn't be addressed in this PR anyway, since that would run the risk of creating PR bloat.

useTimepoints(selectedRouteIds)

const { socket } = useContext(SocketContext)
const alerts = useAlerts(socket, selectedRouteIds)
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactoring the alerts code here worries me a bit because it's completely untested, on main as well as here.

I tried clicking around to test this - I wasn't able to find any alerts visible in skate (either local or prod), so I didn't get a good manual check, but then just for fun, I went ahead and deleted it entirely, and once I removed all the unused imports and things, all of the tests still passed. I tried out the same thing on main, and same deal.

I would feel more comfortable with this if we snuck another PR in front of this one that added some tests that validated the alerts logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Merged main, and the useAlerts test still passes ✅

Copy link
Contributor

@joshlarson joshlarson left a comment

Choose a reason for hiding this comment

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

This comment is my big blocker for approval on this PR - I'm happy to pair on it if that would be helpful!

I have loosely-held opinions about the questions you asked in the PR description:

I lowered some logic from the LadderPage into the RouteLadders component to avoid stubbing out identical logic in MinimalLadderPage. Does that seem rational?

Yeah - When I was thinking that I would pick this story up, that's exactly how I envisioned doing it. Well... sort of - I hadn't looked closely at the RouteLadders and LadderPage code, yet, so I had a slightly different vision based on a slightly wrong guess about how they worked, but IMO, I think this is the right way to do it.

Also, is this PR too big?

Eh.... that's subjective. For my sensibilities, it's hovering right on the cusp. If if were me doing it, I would probably have broken it up into two PR's (plus the third pre-PR that I asked for in my blocking comment, which I do think should be separate from this one):

  • (My requested new one) Add test coverage for alerts, and anything else that might be missing
  • Refactor to lower some of the logic from LadderPage into RouteLadders
  • Add MinimalLadderPage

But it's not tooo tooooo big to combine the "Refactor to lower" work with the "Add MinimalLadderPage" work, so I'm not going to like... insist that you do extra work to split it into two PR's

routeId: RouteId
): Route | undefined => (routes || []).find((route) => route.id === routeId)

// This is tested but never used?
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait is it even tested?

Copy link
Collaborator Author

@hannahpurcell hannahpurcell May 7, 2024

Choose a reason for hiding this comment

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

Ayayaye, I deleted the tests and didn't delete the function def, which is especially foolish! I meant to leave all references to the function intact and raise the question in the PR. Because it is unused, I'm leaning towards deletion and will do so unless instructed otherwise

Copy link

github-actions bot commented May 7, 2024

Coverage of commit bee0f94

Summary coverage rate:
  lines......: 93.7% (3227 of 3443 lines)
  functions..: 73.4% (1337 of 1822 functions)
  branches...: no data found

Files changed coverage rate: n/a

Download coverage report

Copy link

github-actions bot commented May 7, 2024

Coverage of commit ded5cb3

Summary coverage rate:
  lines......: 93.7% (3226 of 3443 lines)
  functions..: 73.3% (1336 of 1822 functions)
  branches...: no data found

Files changed coverage rate: n/a

Download coverage report

@hannahpurcell hannahpurcell requested a review from joshlarson May 7, 2024 17:46
@hannahpurcell hannahpurcell merged commit 3de1f3f into main May 8, 2024
27 checks passed
@hannahpurcell hannahpurcell deleted the hp/add-route-ladders-to-new-endpoint branch May 8, 2024 20:58
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