fix: Don't show non-applicable directional alerts on the line diagram #2923
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scope
Asana Ticket: ❗[AM Alerts] 🐞 Directional alerts are shown on both directions of the line diagram
Implementation
matchesDirectionfor alerts, and use it to filter alerts before they're passed into the<LineDiagram />component.<ScheduleDirection />or downstream of there, because when you switch directions on the line diagram page, the direction ID change is captured instate, but not in the direction ID passed in to the component (which is what's available upstream of<ScheduleDirection />). If we did the filtering anywhere upstream of<ScheduleDirection />(e.g. in<SchedulePage />), then the alerts that are visible on the line diagram would be based on which direction you were looking at when you first navigated to the page, not what direction you're looking at now.Screenshots
Note the same line diagram in the other direction:
How to test
Create a station bypass or suspension that only affects a single direction, and visit the line diagram page for the affected route and switch directions.