Sfoglia il codice sorgente

fix: debounce.flush not invoked if lastArgs not defined (#3281)

David Luzar 4 anni fa
parent
commit
fa8c7abf50
1 ha cambiato i file con 1 aggiunte e 3 eliminazioni
  1. 1 3
      src/utils.ts

+ 1 - 3
src/utils.ts

@@ -131,9 +131,7 @@ export const debounce = <T extends any[]>(
   };
   ret.flush = () => {
     clearTimeout(handle);
-    if (lastArgs) {
-      fn(...lastArgs);
-    }
+    fn(...(lastArgs || []));
   };
   ret.cancel = () => {
     clearTimeout(handle);