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 @@ -201,7 +201,7 @@ ); } -function useThreadInChatList(threadInfo: ?ThreadInfo): boolean { +function useIsThreadInChatList(threadInfo: ?ThreadInfo): boolean { const threadIsVisible = useThreadHasPermission( threadInfo, threadPermissions.VISIBLE, @@ -1918,7 +1918,7 @@ useThreadHasPermission, viewerIsMember, threadInChatList, - useThreadInChatList, + useIsThreadInChatList, threadIsTopLevel, threadIsChannel, threadIsSidebar, diff --git a/native/chat/settings/thread-settings.react.js b/native/chat/settings/thread-settings.react.js --- a/native/chat/settings/thread-settings.react.js +++ b/native/chat/settings/thread-settings.react.js @@ -27,9 +27,9 @@ import { getAvailableRelationshipButtons } from 'lib/shared/relationship-utils.js'; import { getSingleOtherUser, - threadInChatList, threadIsChannel, useThreadHasPermission, + useIsThreadInChatList, viewerIsMember, } from 'lib/shared/thread-utils.js'; import threadWatcher from 'lib/shared/thread-watcher.js'; @@ -1163,15 +1163,16 @@ reduxThreadInfo ?? props.route.params.threadInfo; const resolvedThreadInfo = useResolvedThreadInfo(threadInfo); + const isThreadInChatList = useIsThreadInChatList(threadInfo); React.useEffect(() => { - if (threadInChatList(threadInfo)) { + if (isThreadInChatList) { return undefined; } threadWatcher.watchID(threadInfo.id); return () => { threadWatcher.removeID(threadInfo.id); }; - }, [threadInfo]); + }, [isThreadInChatList, threadInfo.id]); const parentThreadID = threadInfo.parentThreadID; const parentThreadInfo: ?ThreadInfo = useSelector(state => diff --git a/web/chat/thread-list-provider.js b/web/chat/thread-list-provider.js --- a/web/chat/thread-list-provider.js +++ b/web/chat/thread-list-provider.js @@ -15,7 +15,7 @@ getThreadListSearchResults, useThreadListSearch, threadIsPending, - useThreadInChatList, + useIsThreadInChatList, } from 'lib/shared/thread-utils.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; @@ -66,7 +66,7 @@ (activeTab === 'Focus' && activeTopLevelThreadIsFromHomeTab) || (activeTab === 'Background' && !activeTopLevelThreadIsFromHomeTab); - const activeTopLevelThreadIsInChatList = useThreadInChatList( + const activeTopLevelThreadIsInChatList = useIsThreadInChatList( activeTopLevelThreadInfo, );