Fix topics pagination (#1041)

* Fix topics search
This commit is contained in:
Alexander Krivonosov 2021-11-01 17:51:49 +03:00 committed by GitHub
parent c986bc178c
commit 45a2fc2b47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -121,6 +121,13 @@ const List: React.FC<TopicsListProps> = ({
closeConfirmationModal();
clearSelectedTopics();
}, [clusterName, selectedTopics]);
const searchHandler = React.useCallback(
(searchString: string) => {
setTopicsSearch(searchString);
history.push(`${pathname}?page=1&perPage=${perPage || PER_PAGE}`);
},
[search, pathname, perPage]
);
return (
<div className="section">
@ -142,7 +149,7 @@ const List: React.FC<TopicsListProps> = ({
</div>
<div className="column">
<Search
handleSearch={setTopicsSearch}
handleSearch={searchHandler}
placeholder="Search by Topic Name"
value={search}
/>

View file

@ -111,7 +111,7 @@ exports[`List when it does not have readonly flag matches the snapshot 1`] = `
className="column"
>
<Search
handleSearch={[MockFunction]}
handleSearch={[Function]}
placeholder="Search by Topic Name"
value=""
>