Skip to content

Conversation

@alec-georgoff
Copy link
Collaborator

@alec-georgoff alec-georgoff commented Jul 10, 2025

Description:

This PR updates the bikeRentalQuery to use graphQL instead of the deprecated REST endpoint.

Note that the updates to OTP-UI found in this PR must be merged to correctly use the response that comes back from graphQL.

PR Checklist:

  • Does the code follow accessibility standards (WCAG 2.1 AA Compliant)?
  • Are all languages supported (Internationalization/Localization)?
  • Are appropriate Typescript types implemented?

@alec-georgoff alec-georgoff marked this pull request as draft August 7, 2025 17:44
@alec-georgoff alec-georgoff changed the base branch from dev to new-maplibre August 19, 2025 18:22
@alec-georgoff alec-georgoff changed the base branch from new-maplibre to dev August 19, 2025 18:22
@alec-georgoff alec-georgoff added the BLOCKED Blocked (waiting on another PR to be merged) label Sep 9, 2025
@alec-georgoff alec-georgoff removed the BLOCKED Blocked (waiting on another PR to be merged) label Nov 5, 2025
@alec-georgoff alec-georgoff marked this pull request as ready for review November 5, 2025 22:29
Copy link
Contributor

@daniel-heppner-ibigroup daniel-heppner-ibigroup left a comment

Choose a reason for hiding this comment

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

Can you add some more types to the DefaultMap type before I approve?

const micromobility = rentalVehicles.filter(
(vehicle) =>
vehicle.vehicleType &&
vehicle.vehicleType?.formFactor !== FormFactor.CAR
Copy link
Contributor

Choose a reason for hiding this comment

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

This will filter out any vehicles where vehicleType is undefined. Is that intentional? Do scooters/bikes never have undefined? Under what circumstance can it be undefined?

You should be able to remove the ? from the second part of the condition since the null check has already happened.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed the redundant null check.

I think it's better to be more specific here and not include vehicles with an undefined vehicleType. It's better for a user to clearly not see their incorrectly-typed vehicles (and then fix them) than for users to incorrectly see vehicles that don't fit the expected type. Open to discussion though.

Copy link
Contributor

Choose a reason for hiding this comment

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

agree

setLocation: any
setViewedStop: any
viewedRouteStops: any
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could define a bunch of these. There are some low hanging fruit like intl -> IntlShape.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I was able to get all of them (commit). Let me know if any stick out to you!

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!! Perfect

Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. Seems to work and looks clean. Consider the suggested style tweaks and constants use before proceeding.

Comment on lines +681 to +703
export function findBikeRentalStations() {
return function (dispatch) {
dispatch(
createGraphQLQueryAction(
vehicleRentalStationsQuery,
{},
bikeRentalResponse,
bikeRentalError,
{
rewritePayload: (payload) =>
payload.data.vehicleRentalStations.filter(
vehicleRentalStationFilter('BICYCLE')
)
}
)
)
}
}

export const carRentalResponse = createAction('CAR_RENTAL_RESPONSE')
export const carRentalError = createAction('CAR_RENTAL_ERROR')

export function findCarRentalStations() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe for another PR: There is probably a way to make that query once and update the bike and rental states at the same time instead of filtering out the results. We could throttle the callbacks from the respective overlays too.

{
rewritePayload: (payload) =>
payload.data.vehicleRentalStations.filter(
vehicleRentalStationFilter('CAR')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use constant FormFactor.CAR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Interestingly, I think my other usages of FormFactor.CAR are incorrect. Within the types package, FormFactor is a union type:

image

In the default map component, this means that we get type safety when using 'BICYCLE' to compare against station.vehicleType.formFactor, since formFactor carries the FormFactor type:

image

Unfortunately, this apiV2 file is not TypeScript, so we don't get that additional safety here.

@alec-georgoff alec-georgoff merged commit 04363fa into dev Nov 10, 2025
9 checks passed
@alec-georgoff alec-georgoff deleted the vehicle-rental-overlay-graphql-migration branch November 10, 2025 22:47
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.

6 participants