Refetch topics list to display the updated data (#1900)

* 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>
This commit is contained in:
Arsen Simonyan 2022-05-02 13:33:11 +04:00 committed by Arsen Simonyan
parent 45931a63ed
commit 2b5917dd54

View file

@ -88,8 +88,8 @@ const List: React.FC<TopicsListProps> = ({
const [cachedPage, setCachedPage] = React.useState<number | null>(null); const [cachedPage, setCachedPage] = React.useState<number | null>(null);
const history = useHistory(); const history = useHistory();
React.useEffect(() => { const topicsListParams = React.useMemo(
fetchTopicsList({ () => ({
clusterName, clusterName,
page, page,
perPage, perPage,
@ -97,17 +97,13 @@ const List: React.FC<TopicsListProps> = ({
sortOrder, sortOrder,
search, search,
showInternal, showInternal,
}); }),
}, [ [clusterName, page, perPage, orderBy, sortOrder, search, showInternal]
fetchTopicsList, );
clusterName,
page, React.useEffect(() => {
perPage, fetchTopicsList(topicsListParams);
orderBy, }, [fetchTopicsList, topicsListParams]);
sortOrder,
search,
showInternal,
]);
const tableState = useTableState< const tableState = useTableState<
TopicWithDetailedInfo, TopicWithDetailedInfo,
@ -190,6 +186,7 @@ const List: React.FC<TopicsListProps> = ({
} }
closeConfirmationModal(); closeConfirmationModal();
clearSelectedTopics(); clearSelectedTopics();
fetchTopicsList(topicsListParams);
}, [ }, [
confirmationModal, confirmationModal,
clearSelectedTopics, clearSelectedTopics,
@ -197,6 +194,8 @@ const List: React.FC<TopicsListProps> = ({
deleteTopics, deleteTopics,
clearTopicsMessages, clearTopicsMessages,
tableState.selectedIds, tableState.selectedIds,
fetchTopicsList,
topicsListParams,
]); ]);
const ActionsCell = React.memo<TableCellProps<TopicWithDetailedInfo, string>>( const ActionsCell = React.memo<TableCellProps<TopicWithDetailedInfo, string>>(