cacheables
cacheables copied to clipboard
Fix: handle promise rejection and clear pending promise
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.