Page MenuHomePhabricator

[native] introduce edit user avatar provider scaffolding
ClosedPublic

Authored by ginsu on Apr 25 2023, 1:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 13, 9:50 AM
Unknown Object (File)
Mon, May 13, 9:50 AM
Unknown Object (File)
Mon, May 13, 7:23 AM
Unknown Object (File)
Mon, May 13, 7:23 AM
Unknown Object (File)
Mon, May 13, 7:23 AM
Unknown Object (File)
Tue, May 7, 11:07 PM
Unknown Object (File)
Sun, Apr 28, 1:35 PM
Unknown Object (File)
Sun, Apr 28, 1:35 PM
Subscribers

Details

Summary

First step in breaking down D7621. In this diff I introduce the Edit User Avatar provider and moved the remove user avatar functionality from the avatar-hooks to this provider. Future diffs will bring the other edit avatar functionality over to this provider

Depends on D7573

Test Plan

Able to remove an avatar and the behavior is to be expected with removing an avatar and the loading state returns the correct values when the set avatar request was happening

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

native/avatars/edit-user-avatar-provider.react.js
45–48 ↗(On Diff #25715)

This may seem unnecessary but the very next diff will add another condition that will make this block necessary

native/avatars/edit-user-avatar.react.js
46–49 ↗(On Diff #25715)

Eventually we will be able to get rid of this when all the loading logic is put into the edit user avatar provider (a future diff)

ginsu requested review of this revision.Apr 25 2023, 2:16 PM
native/avatars/edit-user-avatar-provider.react.js
45–48 ↗(On Diff #25715)

Edit: not the very next diff but the diff after the next diff

native/avatars/edit-user-avatar-provider.react.js
45–48 ↗(On Diff #25715)
ashoat requested changes to this revision.Apr 25 2023, 5:58 PM

Small fixes

native/avatars/edit-user-avatar-provider.react.js
45–48 ↗(On Diff #25715)

There's no point memoizing a boolean, especially when it's such a simple calculation (even in D7621). Your intuition for memoization is off... ask me about this in the office tomorrow. (Please remove the React.useMemo)

61 ↗(On Diff #25715)

We should still throw here so we emit an UPDATE_USER_AVATAR_FAILED instead of UPDATE_USER_AVATAR_SUCCESS

This revision now requires changes to proceed.Apr 25 2023, 5:58 PM
This revision is now accepted and ready to land.Apr 27 2023, 4:18 AM
This revision was landed with ongoing or failed builds.Apr 27 2023, 10:26 AM
This revision was automatically updated to reflect the committed changes.