2694: Statistics of request count of top clients not always displayed correctly
This commit is contained in:
parent
8ead755b67
commit
9f774d776c
|
@ -3,7 +3,7 @@ import React, {
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import propTypes from 'prop-types';
|
import propTypes from 'prop-types';
|
||||||
import throttle from 'lodash/throttle';
|
import throttle from 'lodash/throttle';
|
||||||
|
@ -25,19 +25,21 @@ const InfiniteTable = ({
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const loader = useRef(null);
|
const loader = useRef(null);
|
||||||
|
const loadingRef = useRef(null);
|
||||||
|
|
||||||
const {
|
const isEntireLog = useSelector((state) => state.queryLogs.isEntireLog);
|
||||||
isEntireLog,
|
const processingGetLogs = useSelector((state) => state.queryLogs.processingGetLogs);
|
||||||
processingGetLogs,
|
|
||||||
} = useSelector((state) => state.queryLogs, shallowEqual);
|
|
||||||
|
|
||||||
const loading = isLoading || processingGetLogs;
|
const loading = isLoading || processingGetLogs;
|
||||||
|
|
||||||
const listener = useCallback(() => {
|
const listener = useCallback(() => {
|
||||||
if (loader.current && isScrolledIntoView(loader.current)) {
|
if (!loadingRef.current && loader.current && isScrolledIntoView(loader.current)) {
|
||||||
dispatch(getLogs());
|
dispatch(getLogs());
|
||||||
}
|
}
|
||||||
}, [loader.current, isScrolledIntoView, getLogs]);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadingRef.current = processingGetLogs;
|
||||||
|
}, [processingGetLogs]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
listener();
|
listener();
|
||||||
|
|
Loading…
Reference in New Issue