diff --git a/frontend/src/components/taskSelection/taskList.js b/frontend/src/components/taskSelection/taskList.js index 088441bfd4..98131c88c1 100644 --- a/frontend/src/components/taskSelection/taskList.js +++ b/frontend/src/components/taskSelection/taskList.js @@ -11,6 +11,7 @@ import messages from './messages'; import { RelativeTimeWithUnit } from '../../utils/formattedRelativeTime'; import { TaskActivity } from './taskActivity'; import { compareTaskId, compareLastUpdate } from '../../utils/sorting'; +import { getItem, setItem } from '../../utils/safe_storage'; import { TASK_COLOURS } from '../../config'; import { LockIcon, ListIcon, ZoomPlusIcon, CloseIcon, InternalLinkIcon } from '../svgIcons'; import { PaginatorLine, howManyPages } from '../paginator'; @@ -207,6 +208,12 @@ export function TaskList({ [readyTasks], ); + useEffect(() => { + const tasksSortOrder = getItem('tasksSortOrder'); + tasksSortOrder && setSortingOption(tasksSortOrder); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + useEffect(() => { if (tasks && tasks.features) { let newTasks = tasks.features; @@ -250,6 +257,7 @@ export function TaskList({ function updateSortingOption(data: Object) { if (data) { setSortingOption(data[0].value); + setItem('tasksSortOrder', data[0].value); } } diff --git a/frontend/src/store/actions/auth.js b/frontend/src/store/actions/auth.js index 6338abaa90..4316025fe0 100644 --- a/frontend/src/store/actions/auth.js +++ b/frontend/src/store/actions/auth.js @@ -44,6 +44,7 @@ export const logout = () => (dispatch) => { safeStorage.removeItem('action'); safeStorage.removeItem('osm_oauth_token'); safeStorage.removeItem('osm_oauth_token_secret'); + safeStorage.removeItem('tasksSortOrder'); dispatch(clearUserDetails()); };