diff --git a/ui-common/src/components/TrafficViewer/TrafficViewer.tsx b/ui-common/src/components/TrafficViewer/TrafficViewer.tsx index d9391ff6c..af72dd605 100644 --- a/ui-common/src/components/TrafficViewer/TrafficViewer.tsx +++ b/ui-common/src/components/TrafficViewer/TrafficViewer.tsx @@ -201,7 +201,9 @@ export const TrafficViewer: React.FC = ({ useEffect(() => { return () => { - ws.current.close(); + if (ws?.current?.readyState === WebSocket.OPEN) { + ws.current.close(); + } }; }, []);