From 947e7ef9081509f9c19d7e13ae85f437a470d034 Mon Sep 17 00:00:00 2001 From: Lam Tang Date: Thu, 18 Aug 2022 18:55:05 +0800 Subject: [PATCH] fix: "0ms" latency was ignored --- src/ui/MessagesView/MessagesView.jsx | 2 +- src/ui/MessagesView/NetLatencyView.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/MessagesView/MessagesView.jsx b/src/ui/MessagesView/MessagesView.jsx index 2235b3b..3bdad6b 100644 --- a/src/ui/MessagesView/MessagesView.jsx +++ b/src/ui/MessagesView/MessagesView.jsx @@ -48,7 +48,7 @@ const MessagesView = () => { send: 0, // the unit is bytes/s receive: 0, }); - const [latency, setLatency] = useState(); + const [latency, setLatency] = useState(null); const [isCompact, setIsCompact] = useState(false); const timer = useRef(null); diff --git a/src/ui/MessagesView/NetLatencyView.jsx b/src/ui/MessagesView/NetLatencyView.jsx index b16cf0c..f6d4a6f 100644 --- a/src/ui/MessagesView/NetLatencyView.jsx +++ b/src/ui/MessagesView/NetLatencyView.jsx @@ -4,7 +4,7 @@ import './NetLatencyView.scss'; const NetLatencyView = ({ capturing, latency }) => { if (!capturing) return null; - if (!latency) { + if (latency === null) { latency = '-ยท-'; } else if (latency > 999) { latency = '999+';