From 07e529bd4e9219c619df7690f8bb12a3ad8e7b37 Mon Sep 17 00:00:00 2001 From: userquin Date: Thu, 29 Jun 2023 14:56:13 +0200 Subject: [PATCH] fix: debounce async function in SSR --- packages/vee-validate/src/utils/common.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/vee-validate/src/utils/common.ts b/packages/vee-validate/src/utils/common.ts index 848cea25c..45ee054e1 100644 --- a/packages/vee-validate/src/utils/common.ts +++ b/packages/vee-validate/src/utils/common.ts @@ -218,10 +218,11 @@ export function debounceAsync Promise, return function (...args: Parameters) { // Run the function after a certain amount of time if (timer) { - window.clearTimeout(timer); + clearTimeout(timer); } - timer = window.setTimeout(() => { + // @ts-expect-error timer is a number + timer = setTimeout(() => { // Get the result of the inner function, then apply it to the resolve function of // each promise that has been created since the last time the inner function was run const result = inner(...(args as any));