Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CacheMap.get calls should await the promised value #319

Open
Assignees
@gabidi

Description

dataloader/src/index.js

Lines 88 to 97 in 015a94c

var cachedPromise = cacheMap.get(cacheKey);
if (cachedPromise) {
var cacheHits = batch.cacheHits || (batch.cacheHits = []);
return new Promise(resolve => {
cacheHits.push(() => {
resolve(cachedPromise);
});
});
}
}

Seems like this prevents the use of async calls to centralized caches in it's current implementation since the returned promise will be 'Truthy' even if it resolves with a cache miss (null, undefined).

Wondering if there is a design reason for this, or a PR is welcome ?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /