소스 검색

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

David Luzar 4 년 전
부모
커밋
fa8c7abf50
1개의 변경된 파일1개의 추가작업 그리고 3개의 파일을 삭제
  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);