1 import { SORT_DIRECTION } from '@proton/shared/lib/constants';
3 import { useDevicesListing } from '../_devices';
4 import { useUserSettings } from '../_settings';
5 import { useMemoArrayNoMatterTheOrder } from './utils';
6 import type { SortField } from './utils/useSortingDevices';
7 import { useSortingWithDefault } from './utils/useSortingDevices';
10 sortField: 'name' as SortField,
11 sortOrder: SORT_DIRECTION.ASC,
14 export default function useDevicesView() {
15 const devicesListing = useDevicesListing();
17 const devices = devicesListing.cachedDevices;
19 const cachedDevices = useMemoArrayNoMatterTheOrder(devices);
21 const { layout } = useUserSettings();
22 const { sortedList } = useSortingWithDefault(cachedDevices, DEFAULT_SORT);
27 isLoading: devicesListing.isLoading,