From fa8c7abf50feecb8b25ef20df8ae3271cb94ae57 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Sat, 20 Mar 2021 13:15:28 +0100 Subject: [PATCH] fix: debounce.flush not invoked if lastArgs not defined (#3281) --- src/utils.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index cd6bc00c..22f86dc6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -131,9 +131,7 @@ export const debounce = ( }; ret.flush = () => { clearTimeout(handle); - if (lastArgs) { - fn(...lastArgs); - } + fn(...(lastArgs || [])); }; ret.cancel = () => { clearTimeout(handle);