瀏覽代碼

clear timer before starting new one

Aakansha Doshi 4 年之前
父節點
當前提交
bc9c8f7ee2
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/components/App.tsx

+ 3 - 0
src/components/App.tsx

@@ -1034,6 +1034,9 @@ class App extends React.Component<ExcalidrawProps, AppState> {
     const speed = await getNetworkSpeed();
     const networkSpeed = speed === "-1" ? "Error!" : speed;
     this.setState({ networkSpeed });
+    if (this.netStatsIntervalId) {
+      clearTimeout(this.netStatsIntervalId);
+    }
     this.netStatsIntervalId = setTimeout(
       this.calculateNetStats,
       NETWORK_SPEED_TIMEOUT_MS,