Page MenuHomePhabricator

[native] Fix infinite image loader
ClosedPublic

Authored by patryk on Jul 3 2023, 6:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 12:47 PM
Unknown Object (File)
Wed, Nov 13, 1:41 PM
Unknown Object (File)
Wed, Nov 13, 1:41 PM
Unknown Object (File)
Wed, Nov 13, 1:41 PM
Unknown Object (File)
Wed, Nov 13, 1:41 PM
Unknown Object (File)
Wed, Nov 13, 1:40 PM
Unknown Object (File)
Wed, Nov 13, 1:32 PM
Unknown Object (File)
Wed, Nov 13, 4:47 AM
Subscribers

Details

Summary

https://linear.app/comm/issue/ENG-4271/encrypted-media-load-failures-display-spinners-infinitely-on-native. In addition, upload error
icon has been changed, to match new error icon (and icon available on web).

Screenshots:

dark1.png (956×453 px, 115 KB)

light1.png (956×453 px, 118 KB)

Test Plan
  1. Change url to local blob service url in lib/facts/blob-service.js
  2. Change useBlobServiceUploads to true in native/input/input-state-container.react.js
  3. Run blob service
  4. To emulate error, disconnect blob service or change result.success to false in native/media/encrypted-image.react.js

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Can you attach a screenshot to the diff description of how the error icon looks like?

native/media/loadable-image.react.js
70 ↗(On Diff #28349)

We should avoid using color constants. Instead, we should use something from our design system (something from Colors type from native/theme/colors.js). Also, it is a good idea to check how it looks like in both light and dark themes.

Use colors declared in native/themes/color.js.

bartek requested changes to this revision.Jul 4 2023, 5:47 AM
bartek added inline comments.
native/media/encrypted-image.react.js
82–83 ↗(On Diff #28374)

We discussed this offline - I'm not too fond of this hack because it makes the code flow unobvious.

I prefer adding a new, optional prop isError (or forceError, I don't have a good idea for the name) to <LoadableImage> which can work together with the error state you introduced. This way we can explicitly tell why the error indicator is displayed.

native/media/loadable-image.react.js
54–69 ↗(On Diff #28374)

I don't know if this will be more readable, just wondering about inverting the code flow here.

Let's suppose we have loaded = false; error = true. The statusIndicator is first created for the loading state and then overwritten by the error indicator. Using else-if we can avoid this.
What do you think?

This revision now requires changes to proceed.Jul 4 2023, 5:47 AM
native/media/loadable-image.react.js
54–69 ↗(On Diff #28374)

I wanted to use a guard clause because I find it more readable. However, as you mentioned, statusIndicator is updated twice. It's not a big deal, I think, but we can avoid unnecessary variable update.

Add errorOccured prop and change guard clause to else-if.

bartek added inline comments.
native/chat/inline-multimedia.react.js
144–147 ↗(On Diff #28394)

Looking at the attached screenshots, you tested how this styling change affects the existing usage of uploadError in inline-multimedia.react.js.

This revision is now accepted and ready to land.Jul 5 2023, 2:52 AM
This revision was automatically updated to reflect the committed changes.