Преглед на файлове

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,