Skip to content

Commit ffa7318

Browse files
authored
fix: debounce async function in SSR (#4340)
1 parent 84aace7 commit ffa7318

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/vee-validate/src/utils/common.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,11 @@ export function debounceAsync<TFunction extends (...args: any) => Promise<any>,
218218
return function (...args: Parameters<TFunction>) {
219219
// Run the function after a certain amount of time
220220
if (timer) {
221-
window.clearTimeout(timer);
221+
clearTimeout(timer);
222222
}
223223

224-
timer = window.setTimeout(() => {
224+
// @ts-expect-error timer is a number
225+
timer = setTimeout(() => {
225226
// Get the result of the inner function, then apply it to the resolve function of
226227
// each promise that has been created since the last time the inner function was run
227228
const result = inner(...(args as any));

0 commit comments

Comments
 (0)