From 342baf8683defcd540127dd029efe8ec065aefd4 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Tue, 13 Jul 2021 10:47:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E8=8E=B7=E5=8F=96token=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared/manager/buildRegFn.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/manager/buildRegFn.ts b/shared/manager/buildRegFn.ts index cacc929a..16cd03da 100644 --- a/shared/manager/buildRegFn.ts +++ b/shared/manager/buildRegFn.ts @@ -53,7 +53,7 @@ export function buildRegFnWithEvent any>( /** * 缓存版本的buildRegFn */ -export function buildCachedRegFn any>( +export function buildCachedRegFn Promise>( name: string, defaultFunc?: F ) { @@ -62,12 +62,12 @@ export function buildCachedRegFn any>( let _result: any = null; // 缓存的返回值 let _lastArgs: any; - const cachedGet = (...args: any) => { + const cachedGet = async (...args: any) => { if (_result !== null && _isEqual(args, _lastArgs)) { // 当有缓存的返回值且两次参数一致 return _result; } else { - const result = get(...args); + const result = await get(...args); _result = result ?? null; _lastArgs = args; return result;