From d834fcc3cbe7b14bdcaf0a741d57deb1d76f1656 Mon Sep 17 00:00:00 2001 From: lirazyehezkel <61656597+lirazyehezkel@users.noreply.github.com> Date: Tue, 19 Apr 2022 19:19:43 +0300 Subject: [PATCH] Entries count changes frequently (#1021) Co-authored-by: leon-up9 <97597983+leon-up9@users.noreply.github.com> --- .../src/components/TrafficViewer/EntriesList.tsx | 12 ++++++------ ui-common/src/configs/Consts.ts | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ui-common/src/components/TrafficViewer/EntriesList.tsx b/ui-common/src/components/TrafficViewer/EntriesList.tsx index d7be38c7e..693c6597a 100644 --- a/ui-common/src/components/TrafficViewer/EntriesList.tsx +++ b/ui-common/src/components/TrafficViewer/EntriesList.tsx @@ -12,7 +12,7 @@ import TrafficViewerApiAtom from "../../recoil/TrafficViewerApi"; import TrafficViewerApi from "./TrafficViewerApi"; import focusedEntryIdAtom from "../../recoil/focusedEntryId"; import {toast} from "react-toastify"; -import {TOAST_CONTAINER_ID} from "../../configs/Consts"; +import {MAX_ENTRIES, TOAST_CONTAINER_ID} from "../../configs/Consts"; import tappingStatusAtom from "../../recoil/tappingStatus"; import leftOffTopAtom from "../../recoil/leftOffTop"; @@ -98,8 +98,8 @@ export const EntriesList: React.FC = ({ setIsLoadingTop(false); const newEntries = [...data.data.reverse(), ...entries]; - if(newEntries.length > 10000) { - newEntries.splice(10000, newEntries.length - 10000) + if(newEntries.length > MAX_ENTRIES) { + newEntries.splice(MAX_ENTRIES, newEntries.length - MAX_ENTRIES) } setEntries(newEntries); @@ -125,9 +125,9 @@ export const EntriesList: React.FC = ({ useEffect(() => { const newEntries = [...entries]; - if (newEntries.length > 10000) { + if (newEntries.length > MAX_ENTRIES) { setLeftOffTop(newEntries[0].id); - newEntries.splice(0, newEntries.length - 10000) + newEntries.splice(0, newEntries.length - MAX_ENTRIES) setNoMoreDataTop(false); setEntries(newEntries); } @@ -209,7 +209,7 @@ export const EntriesList: React.FC = ({
-
Displaying {entries?.length} results out of Displaying {entries?.length > MAX_ENTRIES ? MAX_ENTRIES : entries?.length} results out of {queriedTotal} total
{startTime !== 0 &&
Started listening at