diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js --- a/lib/selectors/thread-selectors.js +++ b/lib/selectors/thread-selectors.js @@ -303,7 +303,7 @@ baseOtherUsersButNoOtherAdmins, ); -function mostRecentReadThread( +function mostRecentlyReadThread( messageStore: MessageStore, threadInfos: { +[id: string]: RawThreadInfo }, ): ?string { @@ -334,12 +334,12 @@ return mostRecent ? mostRecent.threadID : null; } -const mostRecentReadThreadSelector: ( +const mostRecentlyReadThreadSelector: ( state: BaseAppState<*>, ) => ?string = createSelector( (state: BaseAppState<*>) => state.messageStore, (state: BaseAppState<*>) => state.threadStore.threadInfos, - mostRecentReadThread, + mostRecentlyReadThread, ); const threadInfoFromSourceMessageIDSelector: ( @@ -406,8 +406,8 @@ unreadCount, unreadBackgroundCount, otherUsersButNoOtherAdmins, - mostRecentReadThread, - mostRecentReadThreadSelector, + mostRecentlyReadThread, + mostRecentlyReadThreadSelector, sidebarInfoSelector, threadInfoFromSourceMessageIDSelector, locallyUniqueToRealizedThreadIDsSelector, diff --git a/server/src/responders/website-responders.js b/server/src/responders/website-responders.js --- a/server/src/responders/website-responders.js +++ b/server/src/responders/website-responders.js @@ -13,7 +13,7 @@ import { daysToEntriesFromEntryInfos } from 'lib/reducers/entry-reducer'; import { freshMessageStore } from 'lib/reducers/message-reducer'; -import { mostRecentReadThread } from 'lib/selectors/thread-selectors'; +import { mostRecentlyReadThread } from 'lib/selectors/thread-selectors'; import { mostRecentMessageTimestamp } from 'lib/shared/message-utils'; import { threadHasPermission } from 'lib/shared/thread-utils'; import { defaultWebEnabledApps } from 'lib/types/enabled-apps'; @@ -202,7 +202,10 @@ } if (!finalNavInfo.activeChatThreadID) { - const mostRecentThread = mostRecentReadThread(messageStore, threadInfos); + const mostRecentThread = mostRecentlyReadThread( + messageStore, + threadInfos, + ); if (mostRecentThread) { finalNavInfo.activeChatThreadID = mostRecentThread; } diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js --- a/web/redux/redux-setup.js +++ b/web/redux/redux-setup.js @@ -7,7 +7,7 @@ deleteAccountActionTypes, } from 'lib/actions/user-actions'; import baseReducer from 'lib/reducers/master-reducer'; -import { mostRecentReadThreadSelector } from 'lib/selectors/thread-selectors'; +import { mostRecentlyReadThreadSelector } from 'lib/selectors/thread-selectors'; import { invalidSessionDowngrade } from 'lib/shared/account-utils'; import type { Shape } from 'lib/types/core'; import type { EnabledApps } from 'lib/types/enabled-apps'; @@ -144,7 +144,7 @@ ...state, navInfo: { ...state.navInfo, - activeChatThreadID: mostRecentReadThreadSelector(state), + activeChatThreadID: mostRecentlyReadThreadSelector(state), }, }; } diff --git a/web/sidebar/app-switcher.react.js b/web/sidebar/app-switcher.react.js --- a/web/sidebar/app-switcher.react.js +++ b/web/sidebar/app-switcher.react.js @@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux'; import { - mostRecentReadThreadSelector, + mostRecentlyReadThreadSelector, unreadCount, } from 'lib/selectors/thread-selectors'; @@ -19,7 +19,7 @@ const activeChatThreadID = useSelector( state => state.navInfo.activeChatThreadID, ); - const mostRecentReadThread = useSelector(mostRecentReadThreadSelector); + const mostRecentlyReadThread = useSelector(mostRecentlyReadThreadSelector); const activeThreadCurrentlyUnread = useSelector( state => !activeChatThreadID || @@ -36,7 +36,7 @@ payload: { tab: 'chat', activeChatThreadID: activeThreadCurrentlyUnread - ? mostRecentReadThread + ? mostRecentlyReadThread : activeChatThreadID, }, }); @@ -44,7 +44,7 @@ [ dispatch, activeThreadCurrentlyUnread, - mostRecentReadThread, + mostRecentlyReadThread, activeChatThreadID, ], );