Skip to content

Commit

Permalink
Refetch topics list to display the updated data (#1900)
Browse files Browse the repository at this point in the history
* refetch topics list to display the updated data

* fixing sonar code smells (#1826)

* fixing sonar code smells

* removing unnecessary change

* fixing some sonar code smell issues

* making requested changes

* Fix sonar badges in readme (#1906)

Co-authored-by: Robert Azizbekyan <103438454+rAzizbekyan@users.noreply.github.com>
Co-authored-by: Oleg Shur <workshur@gmail.com>
  • Loading branch information
3 people committed May 4, 2022
1 parent 45931a6 commit 2b5917d
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions kafka-ui-react-app/src/components/Topics/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,22 @@ const List: React.FC<TopicsListProps> = ({
const [cachedPage, setCachedPage] = React.useState<number | null>(null);
const history = useHistory();

React.useEffect(() => {
fetchTopicsList({
const topicsListParams = React.useMemo(
() => ({
clusterName,
page,
perPage,
orderBy: orderBy || undefined,
sortOrder,
search,
showInternal,
});
}, [
fetchTopicsList,
clusterName,
page,
perPage,
orderBy,
sortOrder,
search,
showInternal,
]);
}),
[clusterName, page, perPage, orderBy, sortOrder, search, showInternal]
);

React.useEffect(() => {
fetchTopicsList(topicsListParams);
}, [fetchTopicsList, topicsListParams]);

const tableState = useTableState<
TopicWithDetailedInfo,
Expand Down Expand Up @@ -190,13 +186,16 @@ const List: React.FC<TopicsListProps> = ({
}
closeConfirmationModal();
clearSelectedTopics();
fetchTopicsList(topicsListParams);
}, [
confirmationModal,
clearSelectedTopics,
clusterName,
deleteTopics,
clearTopicsMessages,
tableState.selectedIds,
fetchTopicsList,
topicsListParams,
]);

const ActionsCell = React.memo<TableCellProps<TopicWithDetailedInfo, string>>(
Expand Down

0 comments on commit 2b5917d

Please sign in to comment.