Skip to content

Commit

Permalink
## Fix Issue #157 User Preference "Saved Stops" were in reverse order…
Browse files Browse the repository at this point in the history
… as the user saved the stops (#168)

Co-authored-by: Keith Cheng <[email protected]>
  • Loading branch information
chengkeith and chengkeith authored Feb 27, 2024
1 parent b199a22 commit 3c4cfb9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/settings/StopOrderList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const StopOrderList = ({ mode }: { mode: ManageMode }) => {
updateSavedStops,
} = useContext(AppContext);
const [items, setItems] = useState(
// cannot use Array.reverse() as it is in-place reverse
savedStops.filter((id) => id.split("|")[1] in stopList).reverse()
savedStops.filter((id) => id.split("|")[1] in stopList)
);
const { t } = useTranslation();

Expand All @@ -32,7 +31,7 @@ const StopOrderList = ({ mode }: { mode: ManageMode }) => {
const newItems = reorder(items, source.index, destination.index);

setItems(newItems);
setSavedStops(Array.from(newItems).reverse());
setSavedStops(Array.from(newItems));
},
[items, setItems, setSavedStops]
);
Expand Down

0 comments on commit 3c4cfb9

Please sign in to comment.