From 9d08dbdd5d356890a70a83b76e8d17ef1c7690bf Mon Sep 17 00:00:00 2001 From: lirazyehezkel <61656597+lirazyehezkel@users.noreply.github.com> Date: Sun, 3 Apr 2022 21:35:09 +0300 Subject: [PATCH] UI performance fix --- ui-common/src/components/TrafficViewer/EntriesList.tsx | 4 ++-- ui-common/src/components/TrafficViewer/TrafficViewer.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ui-common/src/components/TrafficViewer/EntriesList.tsx b/ui-common/src/components/TrafficViewer/EntriesList.tsx index 81c7b6b07..e34f8e195 100644 --- a/ui-common/src/components/TrafficViewer/EntriesList.tsx +++ b/ui-common/src/components/TrafficViewer/EntriesList.tsx @@ -105,7 +105,7 @@ export const EntriesList: React.FC = ({listEntryREF, onSnapBro const scrollbarVisible = scrollableRef.current?.childWrapperRef.current.clientHeight > scrollableRef.current?.wrapperRef.current.clientHeight; if (ws.current) { - ws.current.onmessage = (e) => { + ws.current.addEventListener("message", (e) => { if (!e?.data) return; const message = JSON.parse(e.data); switch (message.messageType) { @@ -124,7 +124,7 @@ export const EntriesList: React.FC = ({listEntryREF, onSnapBro setQueriedTotal(message.data.total); break; }; - } + }); } return diff --git a/ui-common/src/components/TrafficViewer/TrafficViewer.tsx b/ui-common/src/components/TrafficViewer/TrafficViewer.tsx index 9fbbbab5c..deb4c1d89 100644 --- a/ui-common/src/components/TrafficViewer/TrafficViewer.tsx +++ b/ui-common/src/components/TrafficViewer/TrafficViewer.tsx @@ -175,7 +175,7 @@ export const TrafficViewer: React.FC = ({ setAnalyzeStatus, } if (ws.current) { - ws.current.onmessage = (e) => { + ws.current.addEventListener("message", (e) => { if (!e?.data) return; const message = JSON.parse(e.data); switch (message.messageType) { @@ -209,7 +209,7 @@ export const TrafficViewer: React.FC = ({ setAnalyzeStatus, setStartTime(message.data); break; } - }; + }) } useEffect(() => {