elbywan / wretch-middlewares

Collection of middlewares for the Wretch library. 🎁
MIT License
47 stars 7 forks source link

throttlingCache: TypeError ?(src/throttlingCache/index) error undefined is not an object (evaluating 'x.get(r).forEach') #14

Open vigzmv opened 4 years ago

vigzmv commented 4 years ago

This has been a recurring error on our site, on latest browser version. Couldn't reproduce myself yet. Reporting here for the record, I will see if I can fix this

                return response
            })
            .catch(error => {
                // Reject pending promises on error
                inflight.get(_key).forEach(([resolve, reject]) => reject(error))  <--- HERE
                inflight.delete(_key)
                throw error
            })
    }