diff --git a/src/components/Settings/SettingsLogs/index.tsx b/src/components/Settings/SettingsLogs/index.tsx index 6f79a7c6a..f7530847e 100644 --- a/src/components/Settings/SettingsLogs/index.tsx +++ b/src/components/Settings/SettingsLogs/index.tsx @@ -77,13 +77,13 @@ const SettingsLogs: React.FC = () => { const { data: appData } = useSWR('/api/v1/status/appdata'); useEffect(() => { - const displayString = window.localStorage.getItem('logs-display-settings'); + const filterString = window.localStorage.getItem('logs-display-settings'); - if (displayString) { - const displaySettings = JSON.parse(displayString); + if (filterString) { + const filterSettings = JSON.parse(filterString); - setCurrentFilter(displaySettings.currentFilter); - setCurrentPageSize(displaySettings.currentPageSize); + setCurrentFilter(filterSettings.currentFilter); + setCurrentPageSize(filterSettings.currentPageSize); } }, []); diff --git a/src/components/UserList/index.tsx b/src/components/UserList/index.tsx index 5e0289878..6e1a781af 100644 --- a/src/components/UserList/index.tsx +++ b/src/components/UserList/index.tsx @@ -2,7 +2,7 @@ import axios from 'axios'; import { Field, Form, Formik } from 'formik'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { useToasts } from 'react-toast-notifications'; import useSWR from 'swr'; @@ -110,6 +110,27 @@ const UserList: React.FC = () => { const [selectedUsers, setSelectedUsers] = useState([]); const { user: currentUser } = useUser(); + useEffect(() => { + const filterString = window.localStorage.getItem('ul-filter-settings'); + + if (filterString) { + const filterSettings = JSON.parse(filterString); + + setCurrentSort(filterSettings.currentSort); + setCurrentPageSize(filterSettings.currentPageSize); + } + }, []); + + useEffect(() => { + window.localStorage.setItem( + 'ul-filter-settings', + JSON.stringify({ + currentSort, + currentPageSize, + }) + ); + }, [currentSort, currentPageSize]); + const isUserPermsEditable = (userId: number) => userId !== 1 && userId !== currentUser?.id; const isAllUsersSelected = () => {