diff --git a/lib/hooks/toggle-unread-status.js b/lib/hooks/toggle-unread-status.js --- a/lib/hooks/toggle-unread-status.js +++ b/lib/hooks/toggle-unread-status.js @@ -19,16 +19,16 @@ afterAction: ?() => void, ): () => void { const dispatchActionPromise = useDispatchActionPromise(); + const { currentUser } = threadInfo; const boundSetThreadUnreadStatus: ( request: SetThreadUnreadStatusRequest, ) => Promise = useServerCall( setThreadUnreadStatus, ); const toggleUnreadStatus = React.useCallback(() => { - const { unread } = threadInfo.currentUser; const request = { threadID: threadInfo.id, - unread: !unread, + unread: !currentUser.unread, latestMessage: mostRecentNonLocalMessage, }; dispatchActionPromise( @@ -37,14 +37,15 @@ undefined, { threadID: threadInfo.id, - unread: !unread, + unread: !currentUser.unread, }, ); if (afterAction) { afterAction(); } }, [ - threadInfo, + threadInfo.id, + currentUser.unread, mostRecentNonLocalMessage, dispatchActionPromise, afterAction,