diff --git a/lib/selectors/socket-selectors.js b/lib/selectors/socket-selectors.js --- a/lib/selectors/socket-selectors.js +++ b/lib/selectors/socket-selectors.js @@ -69,13 +69,31 @@ (state: AppState) => state.currentUserInfo, currentCalendarQuery, ( - threadInfos: { +[id: string]: RawThreadInfo }, - entryInfos: { +[id: string]: RawEntryInfo }, - userInfos: UserInfos, - currentUserInfo: ?CurrentUserInfo, - calendarQuery: (calendarActive: boolean) => CalendarQuery, - ) => - async ( + threadInfos: { +[id: string]: RawThreadInfo }, + entryInfos: { +[id: string]: RawEntryInfo }, + userInfos: UserInfos, + currentUserInfo: ?CurrentUserInfo, + calendarQuery: (calendarActive: boolean) => CalendarQuery, + ) => { + if (convertToNewIDSchema) { + threadInfos = convertClientIDsToServerIDs( + keyserverPrefixID, + t.dict(tID, rawThreadInfoValidator), + threadInfos, + ); + userInfos = convertClientIDsToServerIDs( + keyserverPrefixID, + userInfosValidator, + userInfos, + ); + currentUserInfo = convertClientIDsToServerIDs( + keyserverPrefixID, + t.maybe(currentUserInfoValidator), + currentUserInfo, + ); + } + + return async ( calendarActive: boolean, oneTimeKeyGenerator: ?OneTimeKeyGenerator, getSignedIdentityKeysBlob: ?() => Promise, @@ -107,21 +125,6 @@ ); if (convertToNewIDSchema) { - threadInfos = convertClientIDsToServerIDs( - keyserverPrefixID, - t.dict(tID, rawThreadInfoValidator), - threadInfos, - ); - userInfos = convertClientIDsToServerIDs( - keyserverPrefixID, - userInfosValidator, - userInfos, - ); - currentUserInfo = convertClientIDsToServerIDs( - keyserverPrefixID, - t.maybe(currentUserInfoValidator), - currentUserInfo, - ); filteredEntryInfos = convertClientIDsToServerIDs( keyserverPrefixID, t.dict(tID, rawEntryInfoValidator), @@ -228,7 +231,8 @@ } } return clientResponses; - }, + }; + }, ); const sessionStateFuncSelector: (