-
-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avatar: Add
AvatarURL
abstract class, and two subclasses.
We'll soon start instantiating these from raw data at the edge, in the "crunchy shell" pattern [1]. This will help us clean up lots of confusing UI logic in the "soft center" of the app that's in charge of displaying avatars, and we'll be able to uproot several helper functions and simplify some props (often ambiguously `string`-typed) of several React components. This doesn't yet add support for the `user_avatar_url_field_optional` client capability, but it will make it much more straightforward to do so in an upcoming commit. Some of the boilerplate in the subclasses is due to a performance optimization [2] based on an observed ~1s added to the rehydrate time on CZO when URL objects are constructed, vs. about 200ms (and maybe a bit more in the upper tail) when they aren't. During rehydration, we don't need to expensively construct URL objects to validate raw URL strings, as long as we do so at the edge when we receive them from the network. See discussion [3]. [1] https://github.com/zulip/zulip-mobile/blob/master/docs/architecture/crunchy-shell.md [2] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/user_avatar_url_field_optional/near/993660 [3] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/user_avatar_url_field_optional/near/908946
- Loading branch information
1 parent
75e0c4c
commit a1f51e4
Showing
2 changed files
with
393 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.