-
Notifications
You must be signed in to change notification settings - Fork 53
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
set viewedRouteStops
when route viewer is active
#1270
Conversation
81eaa1e
to
d9d4c97
Compare
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.
Just clean up the state mapper. I also noticed that sometimes a handful of stops just don't show up. Is that an OTP thing?
lib/components/map/default-map.tsx
Outdated
state.otp?.transitIndex?.routes?.[viewedRoute]?.patterns || {} | ||
).reduce((acc, cur) => { | ||
return Array.from( | ||
new Set([...cur?.[1]?.stops.map((s) => s.id), ...acc]) |
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 think this can be cleaned up. Remove the Array.from and Set from this and do it outside the reducer so it doesn't have to be repeated on each loop. Also, maybe we can move this to a function above? I found it quite difficult to read what was happening here.
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.
Alternatively just break out more variables. Like put the Object.entries into a variable.
Blocked by #1270 |
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.
Nice thank you!
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.
Looks great!!
Description:
Blocked waiting for opentripplanner/otp-ui#772
PR Checklist: