Explorar el Código

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

David Luzar hace 4 años
padre
commit
fa8c7abf50
Se han modificado 1 ficheros con 1 adiciones y 3 borrados
  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);