diff options
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]); |