diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -22,6 +22,7 @@ import { searchUsers as searchUserCall } from '../actions/user-actions.js'; import ashoat from '../facts/ashoat.js'; import genesis from '../facts/genesis.js'; +import { useLoggedInUserInfo } from '../hooks/account-hooks.js'; import { permissionLookup, getAllThreadPermissions, @@ -1100,9 +1101,7 @@ baseThreadInfo: ?ThreadInfo, ): ExistingThreadInfoFinder { const threadInfos = useSelector(threadInfoSelector); - const viewerID = useSelector( - state => state.currentUserInfo && state.currentUserInfo.id, - ); + const loggedInUserInfo = useLoggedInUserInfo(); const userInfos = useSelector(state => state.userStore.userInfos); const pendingToRealizedThreadIDs = useSelector(state => @@ -1119,9 +1118,10 @@ return realizedThreadInfo; } - if (!viewerID || !threadIsPending(baseThreadInfo.id)) { + if (!loggedInUserInfo || !threadIsPending(baseThreadInfo.id)) { return baseThreadInfo; } + const viewerID = loggedInUserInfo?.id; invariant( threadTypeCanBePending(baseThreadInfo.type), @@ -1164,7 +1164,7 @@ [ baseThreadInfo, threadInfos, - viewerID, + loggedInUserInfo, pendingToRealizedThreadIDs, userInfos, ],