add default sort props (#114294)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Sandra G 2021-10-11 16:18:10 -04:00 committed by GitHub
parent e8d16cddca
commit 328da6f720
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ import { useState, useCallback } from 'react';
import { EuiTableSortingType } from '@elastic/eui';
import { euiTableStorageGetter, euiTableStorageSetter } from '../../components/table';
import { Storage } from '../../../../../../src/plugins/kibana_utils/public';
import { EUI_SORT_ASCENDING } from '../../../common/constants';
interface Pagination {
pageSize: number;
@ -77,7 +78,9 @@ export function useTable(storageKey: string) {
);
// get initial state from localStorage
const [sorting, setSorting] = useState<Sorting>(storageData.sort || { sort: {} });
const [sorting, setSorting] = useState<Sorting>(
storageData.sort || { sort: { field: 'name', direction: EUI_SORT_ASCENDING } }
);
const [query, setQuery] = useState('');