Skip to content

Commit

Permalink
allowing non-promise resolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Charette authored and Frederic Charette committed Dec 16, 2021
1 parent 68570c8 commit 9e8cfe4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function queryBuffer(config, emitter, targetStore) {
this.state = 1;
clearTimeout(this.timer);
emitter.emit('query', { cause, key: this.contextKey, uid: this.uid, size: this.ids.length, params: this.params, contexts: this.contexts, ids: this.ids });
config.resolver(this.ids, this.params, this.contexts)
.then(this.handleQuerySuccess.bind(this), this.handleQueryError.bind(this));
const request = config.resolver(this.ids, this.params, this.contexts);
(request instanceof Promise ? request : Promise.resolve(request)).then(this.handleQuerySuccess.bind(this), this.handleQueryError.bind(this));

if (numCached > 0) {
emitter.emit('cacheHit', numCached);
Expand Down

0 comments on commit 9e8cfe4

Please sign in to comment.