-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Route list date scroll #322
Conversation
|
||
const setNewDate = useCallback( | ||
(value: number) => { | ||
routePlan.setDate(routePlan.date.setDate(routePlan.date.getDate() + value)) |
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.
Don't edit the user's date in the store. Generate a new state for the scroll requests
Show loading indicator only when |
setRouteData((prevData) => [...prevData, routePlan.date.toDateString(), ...trains.data]) | ||
setRouteData((prevData) => | ||
uniqBy([...prevData, routePlan.date.toDateString(), ...trains.data], (item) => { | ||
return typeof item === "string" ? item : item.trains.map((train) => train.departureTimeString).join() |
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.
Unique by train numbers AND departure times as departure times can be the same
item.trains.map((train) => train.trainNumber).join()
Closes #279