Page MenuHomePhabricator

[native] cache LoadableImage in memory and disk
ClosedPublic

Authored by varun on Sat, Mar 15, 11:16 AM.
Tags
None
Referenced Files
F4948404: D14443.id47407.diff
Wed, Mar 19, 9:26 PM
F4948373: D14443.id.diff
Wed, Mar 19, 9:10 PM
F4948358: D14443.id47406.diff
Wed, Mar 19, 9:05 PM
F4947408: D14443.diff
Wed, Mar 19, 2:48 PM
Unknown Object (File)
Tue, Mar 18, 6:03 PM
Unknown Object (File)
Tue, Mar 18, 10:27 AM
Unknown Object (File)
Sun, Mar 16, 6:13 AM
Unknown Object (File)
Sun, Mar 16, 6:13 AM
Subscribers

Details

Summary

The disk lookup for avatars with remote URLs causes a flicker. We can cache in memory as well to remove this flicker. We keep the disk cache as a fallback (e.g. for offline mode).

From the expo docs:

Memory cache may be purged very quickly to prevent high memory usage and the risk of out of memory exceptions.

It seems safe to cache in memory, and I feel like we've seen this flicker elsewhere (maybe encrypted images?), so I've changed the cache policy for all LoadableImages, but can narrow the scope to just Avatars if desired.

Test Plan

Confirmed on simulator and physical device that flicker doesn't occur

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat published this revision for review.Sat, Mar 15, 11:26 AM
ashoat accepted this revision.
ashoat added inline comments.
native/media/loadable-image.react.js
21 ↗(On Diff #47406)

Accidental or was this Prettier?

This revision is now accepted and ready to land.Sat, Mar 15, 11:26 AM
native/media/loadable-image.react.js
21 ↗(On Diff #47406)

accidental.. will undo

Emscripten failure is weird, not sure why that's happening, but definitely unrelated to this diff (perhaps the issue is live on master). Created ENG-10380 to investigate

This revision was landed with ongoing or failed builds.Sat, Mar 15, 2:15 PM
This revision was automatically updated to reflect the committed changes.