-
Notifications
You must be signed in to change notification settings - Fork 37
Remove stop_id from display logic in favor of stop_code
#895
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
base: master
Are you sure you want to change the base?
Remove stop_id from display logic in favor of stop_code
#895
Conversation
daniel-heppner-ibigroup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to have to check out what's going on with typescript here and why it's not giving an error for this
| } | ||
| return stopCode || stopId?.split(":")[1] || stopId; | ||
| return stopCode || null; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised you're not getting a type error from this. Null is not a valid return type from this function. I suggest using undefined instead, add it to the return type, and instead of using let stopCode just refactor the function to return from inside the if else blocks.
Also noting that using || is not safe with strings because "" is considered falsey and || checks for falsey. Use ?? instead which is actually checking for null or undefined only.
| */ | ||
| export function getDisplayedStopId(placeOrStop: Place | Stop): string { | ||
| let stopId; | ||
| export function getDisplayedStopCode(placeOrStop: Place | Stop): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renaming this function is a breaking change!
Refactored a
core-utilfunction to only returnstop_codeif found for display in the UI. UI language has been updated to reflect these changes in the packagesitinerary-bodyandprintable-itinerary.