sambernard / react-preload

Component to preload images before showing content
MIT License
148 stars 48 forks source link

ImageCache - `loadImages` add .catch to Promise.all to handle reject; IE11 cached images race condition fix #19

Closed pgraci closed 7 years ago

pgraci commented 7 years ago

This commit fixes IE throwing 'unhandled promise rejection' when the Promise is rejected.

IE11 sometimes reports cached images as image.complete, but naturalWidth and naturalHeight = 0. A few ms later it will get the dimensions correct, so check a few times before rejecting it.