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

This commit is contained in:
David Luzar 2021-03-20 13:15:28 +01:00 committed by GitHub
parent c3ecbcb3ab
commit fa8c7abf50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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