cacheables icon indicating copy to clipboard operation
cacheables copied to clipboard

Fix: handle promise rejection and clear pending promise

Open hodlen opened this issue 2 years ago • 0 comments

Relevant to #6 . When the resource function returns a rejected promise, the #fetch function throws immediately without clearing the #promise field. So in every calls of #fetchNonConcurrent later, it would go into the isFetching branch and throw the same error/rejected promise.

The new test case illustrates its erroneous behaviour. Before the fix, the return value of rejecting function is 1 every time.

hodlen avatar Jan 19 '23 07:01 hodlen