From 1e7c3ed0e8acf583c0d026d74feca743baba0ba7 Mon Sep 17 00:00:00 2001 From: yangchangtao Date: Mon, 23 Sep 2024 19:20:23 +0800 Subject: [PATCH] chore: update --- packages/runtime-core/src/scheduler.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/runtime-core/src/scheduler.ts b/packages/runtime-core/src/scheduler.ts index 5a57aa30e2b..931bb143cfb 100644 --- a/packages/runtime-core/src/scheduler.ts +++ b/packages/runtime-core/src/scheduler.ts @@ -63,13 +63,14 @@ export function nextTick( const p = currentFlushPromise || resolvedPromise let wrapperFn: ((this: T) => R | Promise | undefined) | undefined = fn if (!currentFlushPromise) { - wrapperFn = function () { - if (!fn) return - if (currentFlushPromise) { - return currentFlushPromise.then(fn.bind(this)) - } - return fn.call(this) - } + wrapperFn = fn + ? function () { + if (currentFlushPromise) { + return currentFlushPromise.then(fn.bind(this)) + } + return fn.call(this) + } + : void 0 } return wrapperFn ? p.then(this ? wrapperFn.bind(this) : wrapperFn) : p }