Skip to content

Commit c3b57e5

Browse files
committed
fix: async cache in request usage
1 parent 70f7e37 commit c3b57e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/request/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable max-lines-per-function */
12
/*!
23
* V4Fire Core
34
* https://github.com/V4Fire/Core
@@ -250,7 +251,7 @@ function request<D = unknown>(
250251
fromCache = false;
251252

252253
if (cacheKey != null && ctx.canCache) {
253-
if (ctx.pendingCache.has(cacheKey)) {
254+
if (await ctx.pendingCache.has(cacheKey)) {
254255
try {
255256
const
256257
res = await ctx.pendingCache.get(cacheKey);
@@ -277,7 +278,7 @@ function request<D = unknown>(
277278
})));
278279
}
279280

280-
fromCache = await AbortablePromise.resolve(ctx.cache.has(cacheKey), requestPromise);
281+
fromCache = await AbortablePromise.resolve(await ctx.cache.has(cacheKey), requestPromise);
281282
}
282283

283284
let

0 commit comments

Comments
 (0)