Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3359684
D7528.id25387.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D7528.id25387.diff
View Options
diff --git a/native/avatars/avatar-hooks.js b/native/avatars/avatar-hooks.js
--- a/native/avatars/avatar-hooks.js
+++ b/native/avatars/avatar-hooks.js
@@ -288,9 +288,12 @@
return selectFromGalleryAndUpdateThreadAvatar;
}
-function useRemoveUserAvatar(): () => Promise<void> {
+function useRemoveUserAvatar(): [() => Promise<void>, boolean] {
const dispatchActionPromise = useDispatchActionPromise();
const updateUserAvatarCall = useServerCall(updateUserAvatar);
+ const updateUserAvatarLoadingStatus: LoadingStatus = useSelector(
+ updateUserAvatarLoadingStatusSelector,
+ );
const removeUserAvatar = React.useCallback(async () => {
const removeAvatarRequest: UpdateUserAvatarRemoveRequest = {
@@ -303,7 +306,10 @@
);
}, [dispatchActionPromise, updateUserAvatarCall]);
- return removeUserAvatar;
+ return React.useMemo(
+ () => [removeUserAvatar, updateUserAvatarLoadingStatus === 'loading'],
+ [removeUserAvatar, updateUserAvatarLoadingStatus],
+ );
}
function useRemoveThreadAvatar(threadID: string): () => Promise<void> {
diff --git a/native/avatars/edit-user-avatar.react.js b/native/avatars/edit-user-avatar.react.js
--- a/native/avatars/edit-user-avatar.react.js
+++ b/native/avatars/edit-user-avatar.react.js
@@ -22,7 +22,7 @@
const [selectFromGalleryAndUpdateUserAvatar] =
useSelectFromGalleryAndUpdateUserAvatar();
- const removeUserAvatar = useRemoveUserAvatar();
+ const [removeUserAvatar] = useRemoveUserAvatar();
const actionSheetConfig = React.useMemo(
() => [
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 10:22 AM (19 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2579046
Default Alt Text
D7528.id25387.diff (1 KB)
Attached To
Mode
D7528: [native] Update `useRemoveUserAvatar` to return `isLoading`
Attached
Detach File
Event Timeline
Log In to Comment