Browse Source

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

David Luzar 4 năm trước cách đây
mục cha
commit
fa8c7abf50
1 tập tin đã thay đổi với 1 bổ sung3 xóa
  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);