diff --git a/lib/components/base-edit-thread-avatar-provider.react.js b/lib/components/base-edit-thread-avatar-provider.react.js --- a/lib/components/base-edit-thread-avatar-provider.react.js +++ b/lib/components/base-edit-thread-avatar-provider.react.js @@ -26,7 +26,7 @@ selection: NativeMediaSelection, threadID: string, ) => Promise, - +setThreadAvatar: ( + +baseSetThreadAvatar: ( threadID: string, avatarRequest: UpdateUserAvatarRequest, ) => Promise, @@ -113,7 +113,9 @@ ], ); - const setThreadAvatar = React.useCallback( + // NOTE: Do NOT consume `baseSetThreadAvatar` directly. + // Use platform-specific `[web/native]SetThreadAvatar` instead. + const baseSetThreadAvatar = React.useCallback( async (threadID: string, avatarRequest: UpdateUserAvatarRequest) => { const updateThreadRequest: UpdateThreadRequest = { threadID, @@ -135,9 +137,9 @@ () => ({ threadAvatarSaveInProgress, updateImageThreadAvatar, - setThreadAvatar, + baseSetThreadAvatar, }), - [threadAvatarSaveInProgress, updateImageThreadAvatar, setThreadAvatar], + [threadAvatarSaveInProgress, updateImageThreadAvatar, baseSetThreadAvatar], ); return ( 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 @@ -314,7 +314,7 @@ ) => Promise { const editThreadAvatarContext = React.useContext(EditThreadAvatarContext); invariant(editThreadAvatarContext, 'editThreadAvatarContext must be defined'); - const { setThreadAvatar } = editThreadAvatarContext; + const { baseSetThreadAvatar } = editThreadAvatarContext; const nativeSetThreadAvatar = React.useCallback( async ( @@ -322,13 +322,13 @@ avatarRequest: UpdateUserAvatarRequest, ): Promise => { try { - await setThreadAvatar(threadID, avatarRequest); + await baseSetThreadAvatar(threadID, avatarRequest); } catch (e) { displayAvatarUpdateFailureAlert(); throw e; } }, - [setThreadAvatar], + [baseSetThreadAvatar], ); return nativeSetThreadAvatar;