Skip to content

Commit

Permalink
fix table query
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunian committed Sep 21, 2021
1 parent eecc0ad commit 1862306
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions x-pack/plugins/monitoring/public/application/hooks/use_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function useTable(storageKey: string) {
return sort;
};

const [queryText, setQueryText] = useState('');
const [query, setQuery] = useState('');

const onTableChange = () => {
// we are already updating the state in fetchMoreData. We would need to check in react
Expand All @@ -115,9 +115,9 @@ export function useTable(storageKey: string) {
index: pagination.pageIndex,
},
...sorting,
queryText,
queryText: query,
};
}, [pagination, queryText, sorting]);
}, [pagination, query, sorting]);

const getPaginationTableProps = () => {
return {
Expand All @@ -127,11 +127,11 @@ export function useTable(storageKey: string) {
fetchMoreData: async ({
page,
sort,
query,
queryText,
}: {
page: Page;
sort: Sorting;
query: string;
queryText: string;
}) => {
setPagination({
...pagination,
Expand All @@ -144,7 +144,7 @@ export function useTable(storageKey: string) {
},
});
setSorting(cleanSortingData(sort));
setQueryText(query);
setQuery(queryText);

setLocalStorageData(storage, {
page,
Expand Down

0 comments on commit 1862306

Please sign in to comment.