소스 검색

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,