Fix WS error when switching from settings to traffic viewer (#985)

This commit is contained in:
lirazyehezkel 2022-04-11 14:21:31 +03:00 committed by GitHub
parent bbb44dae79
commit 4bc83ebcb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,7 +201,9 @@ export const TrafficViewer: React.FC<TrafficViewerProps> = ({
useEffect(() => {
return () => {
ws.current.close();
if (ws?.current?.readyState === WebSocket.OPEN) {
ws.current.close();
}
};
}, []);