Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images occasionally fail to render after background #86

Open
oddanderson opened this issue Aug 9, 2024 · 3 comments
Open

Images occasionally fail to render after background #86

oddanderson opened this issue Aug 9, 2024 · 3 comments

Comments

@oddanderson
Copy link

My config:

CacheManager.config = {
  baseDir: `${Dirs.CacheDir}/images_cache/`,
  blurRadius: 15,
  cacheLimit: 1024 * 1024 * 20,
  maxRetries: 3,
  retryDelay: 200,
  sourceAnimationDuration: 200,
  thumbnailAnimationDuration: 200,
};

Using Expo to install.

Happens on iOS, reproduceable only on a device, not simulator.

On app open, the images all load correctly in a FlatList. However, after backgrounding the app for ~2 minutes and re-opening, many of the images that had previously loaded will gone and will not return without force quitting.

@oddanderson
Copy link
Author

I did identify what's happening.

If the cache limit is hit and images are pruned while in a Flatlist, there is nothing that will trigger re-fetching the images until the flatlist items are recycled, which doesn't seem to happen very often.

@vieraleonel
Copy link

@oddanderson did you find any workaround for this?

@oddanderson
Copy link
Author

@vieraleonel we did two things:

  1. we used a separate smaller image to cache in flat lists
  2. increased cache limit

since then we haven't had any issues. we started with a pretty aggressive cache limit. bc flatlist doesn't immediately recycle views as you scroll, you want to make sure your cache limit is substantially larger than a few scrolled screens of a flatlist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants