diff --git a/lib/tunnelbroker/peer-to-peer-message-handler.js b/lib/tunnelbroker/peer-to-peer-message-handler.js --- a/lib/tunnelbroker/peer-to-peer-message-handler.js +++ b/lib/tunnelbroker/peer-to-peer-message-handler.js @@ -7,6 +7,7 @@ useHandleOlmMessageToDevice, usePeerToPeerMessageHandler, } from './use-peer-to-peer-message-handler.js'; +import { useLoggedInUserInfo } from '../hooks/account-hooks.js'; import type { InboundP2PMessage } from '../types/sqlite-types.js'; import type { MessageReceiveConfirmation } from '../types/tunnelbroker/message-receive-confirmation-types.js'; import { @@ -164,8 +165,10 @@ socketSend, ]); + const loggedInUserInfo = useLoggedInUserInfo(); + const viewerID = loggedInUserInfo?.id; React.useEffect(() => { - if (isProcessing) { + if (isProcessing || !viewerID) { return; } if (!processedInboundMessages) { @@ -179,6 +182,7 @@ processMessage, processedInboundMessages, processPersistedInboundMessages, + viewerID, ]); React.useEffect(() => {