Persist show all devices

This commit is contained in:
Anton Tananaev 2024-11-08 10:56:28 -08:00
parent 62f6da1f5c
commit 028329ae74

View File

@ -17,6 +17,7 @@ import { formatTime } from '../common/util/formatter';
import { useDeviceReadonly, useManager } from '../common/util/permissions'; import { useDeviceReadonly, useManager } from '../common/util/permissions';
import useSettingsStyles from './common/useSettingsStyles'; import useSettingsStyles from './common/useSettingsStyles';
import DeviceUsersValue from './components/DeviceUsersValue'; import DeviceUsersValue from './components/DeviceUsersValue';
import usePersistedState from '../common/util/usePersistedState';
const DevicesPage = () => { const DevicesPage = () => {
const classes = useSettingsStyles(); const classes = useSettingsStyles();
@ -31,7 +32,7 @@ const DevicesPage = () => {
const [timestamp, setTimestamp] = useState(Date.now()); const [timestamp, setTimestamp] = useState(Date.now());
const [items, setItems] = useState([]); const [items, setItems] = useState([]);
const [searchKeyword, setSearchKeyword] = useState(''); const [searchKeyword, setSearchKeyword] = useState('');
const [showAll, setShowAll] = useState(false); const [showAll, setShowAll] = usePersistedState('showAllDevices', false);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
useEffectAsync(async () => { useEffectAsync(async () => {
@ -110,7 +111,7 @@ const DevicesPage = () => {
<FormControlLabel <FormControlLabel
control={( control={(
<Switch <Switch
value={showAll} checked={showAll}
onChange={(e) => setShowAll(e.target.checked)} onChange={(e) => setShowAll(e.target.checked)}
size="small" size="small"
/> />