react-native-image-cache-wrapper icon indicating copy to clipboard operation
react-native-image-cache-wrapper copied to clipboard

Strange error

Open abeltje1 opened this issue 8 years ago • 4 comments

Hi! awesome lib!

When using this lib it sometimes throws the following error (reported through Sentry):

“77ab588ac3938d063510281b53c356990913c94b.png.tmp” couldn’t be moved to “CachedImage” because either the former doesn’t exist, or the folder containing the latter doesn’t exist.

We display profile pictures of users a lot of times on a page. What happens is that most of the times the image loads properly, but some of the times it doesn't load at all (and that's when the above error occurs). The strangest thing is that it looks quite random: if a user is displayed on a page five times, sometimes it loads his profile picture properly 4 times and doesn't 1 time. That's the same picture, displaying 4 / 5 times and not showing anything 1 / 5 times.

It seems to complain that the 'CachedImage' folder doesn't exist, which sounds nonsensical to me, but maybe you (as author) understand more of this.

Thanks in advance!

abeltje1 avatar Nov 12 '18 16:11 abeltje1

Hey @abeltje1 , I'm seeing the same error. Did you ever get to the bottom of it?

benjiekibblewhite avatar Mar 15 '19 17:03 benjiekibblewhite

any solution ? I got a lot of these errors

Jackyaung avatar Aug 06 '19 13:08 Jackyaung

Same issue here, it's random @abeltje1 did you find a solution, is this only an issue in development, does it work fine in production?

rokebrand avatar Aug 15 '19 11:08 rokebrand

Hi There. I had the same issue and was able to sole it! The problem was with the "CachedImage.prefetch" function. This error occurred alway when the module tried to cache the same image twice or multiple times. You have to check if an image was stored before...

CachedImage.isUrlCached(url, exists => {
      if (!exists) {
        CachedImage.prefetch(url, 3600, (cacheFile) => {
            // Do something after image was cached... 
          }, (error) => {
            // Manage cache error... 
          });
      } else {
        // Skip caching image which was alreday chached before... ;)
      }
    });

Hope this helped. :)

VBJeffrey avatar Nov 07 '19 16:11 VBJeffrey