Skip to content

Commit

Permalink
hotfix(ScheduleDirection): fix subway line diagram pages
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Sep 29, 2023
1 parent af0ae9e commit 3dfdc4e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions apps/site/assets/ts/schedule/components/ScheduleDirection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ export const fetchLineData = (
})
.then(({ stop_tree, route_stop_lists }) => {
const stopTree = stop_tree ? fromStopTreeData(stop_tree) : null;
const routeStopListsWithIndices: IndexedRouteStop[][] = (route_stop_lists as RouteStop[][]).map(
rs_list => rs_list.map((rs, index) => ({ ...rs, routeIndex: index }))
);
const routeStopListsWithIndices: IndexedRouteStop[][] = route_stop_lists
? (route_stop_lists as RouteStop[][]).map(rs_list =>
rs_list.map((rs, index) => ({ ...rs, routeIndex: index }))
)
: [];
dispatch({
type: "FETCH_COMPLETE",
payload: { stopTree, routeStopLists: routeStopListsWithIndices }
Expand Down Expand Up @@ -233,9 +235,9 @@ const ScheduleDirection = ({
<ScheduleDirectionButton dispatch={dispatch} />
) : null}
</div>
{isSubwayRoute(route) && (
{isSubwayRoute(route) && lineState.data && (
<LineDiagram
stopTree={lineState.data && lineState.data.stopTree}
stopTree={lineState.data.stopTree}
routeStopList={routeStopList}
route={route}
directionId={state.directionId}
Expand Down

0 comments on commit 3dfdc4e

Please sign in to comment.