isaachinman / wundershine-native-app

0 stars 0 forks source link

Lazy-loading for ImageQueue #113

Closed isaachinman closed 6 years ago

isaachinman commented 6 years ago

Is your feature request related to a problem? Please describe. From Mick:

A longer queue can take up to 40 seconds to load. I think that is when the cache is deleted or something. Try account bo@bo.nl PW Bo.

Describe the solution you'd like We should lazy-load queue item images, from top to bottom.

Describe alternatives you've considered N/A

Additional context Unfortunately this is affected by transitions between queue items (upon rearrange). If we only render the first 10 elements in a flat list of 100, and then move item number 1 to spot number 100, the layout animation will not work. I need to think of a way to support both layout animations and lazy-loading of our flat list.

Tintels commented 6 years ago

With latest testing the loading time has not been in the 40 second range anymore. Sometimes still around 10 seconds, usually less. Perhaps something changed at Cloudinary or even (their?) CDN? Or it could still reappear when the phone OS has closed the app / cache more permanently or someting.

In any case, when the extreme loading times do not appear anymore, this issue has become less urgent and perhaps issue #114 can be implemented in a more straightforward manner.

isaachinman commented 6 years ago

Perhaps something changed at Cloudinary or even (their?) CDN

Most likely your own network conditions changed. I am still going to work on this issue, as it should be relatively easy to implement cascading priority levels via FastImage.

isaachinman commented 6 years ago

So out of the box, FastImage provides three priority levels: low, medium, and high.

I've therefore split the ImageQueue items into three groups, where the first 33% of items are high priority, the middle 33% are medium priority, and the last 33% are low priority.

This is a very simplistic approach, but is likely robust enough for the short and medium terms. If we need to eventually engineer a more sophisticated approach sometime in the future, we can.

isaachinman commented 6 years ago

f3a0041