diff --git a/lib/handlers/initial-state-sharing-handler.react.js b/lib/handlers/initial-state-sharing-handler.react.js --- a/lib/handlers/initial-state-sharing-handler.react.js +++ b/lib/handlers/initial-state-sharing-handler.react.js @@ -3,6 +3,7 @@ import invariant from 'invariant'; import * as React from 'react'; +import { useIsLoggedInToIdentityAndAuthoritativeKeyserver } from '../hooks/account-hooks.js'; import { getOwnPeerDevices } from '../selectors/user-selectors.js'; import { dmOperationSpecificationTypes, @@ -26,8 +27,14 @@ const deviceIDs = React.useRef<$ReadOnlySet>(new Set(userDeviceIDs)); + const loggedIn = useIsLoggedInToIdentityAndAuthoritativeKeyserver(); + React.useEffect(() => { void (async () => { + if (!loggedIn) { + return; + } + const oldDeviceIDs = deviceIDs.current; const newDeviceIDs = new Set(userDeviceIDs); deviceIDs.current = newDeviceIDs; @@ -76,6 +83,7 @@ } })(); }, [ + loggedIn, identityContext, processAndSendDMOperation, threadInfos,