diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -9,7 +9,7 @@ sortCalendarQueryPerKeyserver, } from '../keyserver-conn/keyserver-call-utils.js'; import type { CallKeyserverEndpoint } from '../keyserver-conn/keyserver-conn-types.js'; -import { preRequestUserStateSelector } from '../selectors/account-selectors.js'; +import { usePreRequestUserState } from '../selectors/account-selectors.js'; import { getOneTimeKeyValuesFromBlob, getPrekeyValueFromBlob, @@ -118,7 +118,7 @@ const client = React.useContext(IdentityClientContext); const identityClient = client?.identityClient; - const preRequestUserState = useSelector(preRequestUserStateSelector); + const preRequestUserState = usePreRequestUserState(); const callKeyserverLogOut = useKeyserverCall(keyserverLogOut); const commServicesAccessToken = useSelector( @@ -222,7 +222,7 @@ function useDeleteKeyserverAccount(): ( keyserverIDs?: $ReadOnlyArray, ) => Promise { - const preRequestUserState = useSelector(preRequestUserStateSelector); + const preRequestUserState = usePreRequestUserState(); const callKeyserverDeleteAccount = useKeyserverCall(deleteKeyserverAccount); return React.useCallback( @@ -242,7 +242,7 @@ const client = React.useContext(IdentityClientContext); const identityClient = client?.identityClient; - const preRequestUserState = useSelector(preRequestUserStateSelector); + const preRequestUserState = usePreRequestUserState(); const callKeyserverDeleteAccount = useKeyserverCall(deleteKeyserverAccount); const commServicesAccessToken = useSelector( diff --git a/lib/selectors/account-selectors.js b/lib/selectors/account-selectors.js --- a/lib/selectors/account-selectors.js +++ b/lib/selectors/account-selectors.js @@ -21,6 +21,7 @@ PreRequestUserKeyserverSessionInfo, } from '../types/session-types.js'; import type { CurrentUserInfo } from '../types/user-types.js'; +import { useSelector } from '../utils/redux-utils.js'; const logInExtraInfoSelector: (state: AppState) => LogInExtraInfo = createSelector( @@ -97,8 +98,12 @@ }, ); +function usePreRequestUserState(): PreRequestUserState { + return useSelector(preRequestUserStateSelector); +} + export { logInExtraInfoSelector, preRequestUserStateForSingleKeyserverSelector, - preRequestUserStateSelector, + usePreRequestUserState, };