diff options
author | Anton Tananaev <anton@traccar.org> | 2022-04-17 13:33:27 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-04-17 13:33:27 -0700 |
commit | 6505a13e0037d5de5737e940907cc62c4a9107bc (patch) | |
tree | c4b4ceeb0a8b4bd7b688ca4c6f1fd59834cc9f6f /modern/src/DevicesList.js | |
parent | e470eeb4fcc923bc54968a6561f66c75dab288b9 (diff) | |
download | trackermap-web-6505a13e0037d5de5737e940907cc62c4a9107bc.tar.gz trackermap-web-6505a13e0037d5de5737e940907cc62c4a9107bc.tar.bz2 trackermap-web-6505a13e0037d5de5737e940907cc62c4a9107bc.zip |
Refactor settings layout
Diffstat (limited to 'modern/src/DevicesList.js')
-rw-r--r-- | modern/src/DevicesList.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modern/src/DevicesList.js b/modern/src/DevicesList.js index 0ea07319..15a88874 100644 --- a/modern/src/DevicesList.js +++ b/modern/src/DevicesList.js @@ -108,14 +108,15 @@ const DeviceView = ({ updateTimestamp, onMenuClick, filter }) => { const dispatch = useDispatch(); const listInnerEl = useRef(null); - const items = useSelector((state) => Object.values(state.devices.items)); + const items = useSelector((state) => state.devices.items); const [filteredItems, setFilteredItems] = useState(null); useEffect(() => { + const array = Object.values(items); setFilteredItems( filter.trim().length > 0 - ? items.filter((item) => `${item.name} ${item.uniqueId}`.toLowerCase().includes(filter?.toLowerCase())) - : items, + ? array.filter((item) => `${item.name} ${item.uniqueId}`.toLowerCase().includes(filter?.toLowerCase())) + : array, ); }, [filter, items]); |