From 5d4bce3e040d76343c4265e6e970198afdd2fcfe Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 17 May 2023 10:45:09 +1000 Subject: [PATCH] fix: keep the "no pending message requests" opened when none are there --- .../leftpane/overlay/OverlayMessageRequest.tsx | 15 ++------------- ts/session/onions/onionPath.ts | 5 ++++- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/ts/components/leftpane/overlay/OverlayMessageRequest.tsx b/ts/components/leftpane/overlay/OverlayMessageRequest.tsx index 5d9bd695a..cc63d7cff 100644 --- a/ts/components/leftpane/overlay/OverlayMessageRequest.tsx +++ b/ts/components/leftpane/overlay/OverlayMessageRequest.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React from 'react'; // tslint:disable: no-submodule-imports use-simple-attributes import { useDispatch, useSelector } from 'react-redux'; @@ -6,9 +6,8 @@ import useKey from 'react-use/lib/useKey'; import styled from 'styled-components'; import { declineConversationWithoutConfirm } from '../../../interactions/conversationInteractions'; import { forceSyncConfigurationNowIfNeeded } from '../../../session/utils/sync/syncUtils'; -import { resetConversationExternal } from '../../../state/ducks/conversations'; import { updateConfirmModal } from '../../../state/ducks/modalDialog'; -import { SectionType, resetOverlayMode, showLeftPaneSection } from '../../../state/ducks/section'; +import { resetOverlayMode } from '../../../state/ducks/section'; import { getConversationRequests } from '../../../state/selectors/conversations'; import { useSelectedConversationKey } from '../../../state/selectors/selectedConversation'; import { SessionButton, SessionButtonColor } from '../../basic/SessionButton'; @@ -52,16 +51,6 @@ export const OverlayMessageRequest = () => { const convoRequestCount = useSelector(getConversationRequests).length; const messageRequests = useSelector(getConversationRequests); - useEffect(() => { - // if no more requests, return to placeholder screen - - if (convoRequestCount === 0) { - dispatch(resetOverlayMode()); - dispatch(showLeftPaneSection(SectionType.Message)); - dispatch(resetConversationExternal()); - } - }, [dispatch, convoRequestCount]); - const buttonText = window.i18n('clearAll'); /** diff --git a/ts/session/onions/onionPath.ts b/ts/session/onions/onionPath.ts index 737398a83..0fb74988b 100644 --- a/ts/session/onions/onionPath.ts +++ b/ts/session/onions/onionPath.ts @@ -497,7 +497,10 @@ async function buildNewOnionPathsWorker() { for (let i = 0; i < maxPath; i += 1) { const path = [guards[i]]; for (let j = 0; j < nodesNeededPerPaths; j += 1) { - const randomWinner = _.sample(otherNodes) as Snode; + const randomWinner = _.sample(otherNodes); + if (!randomWinner) { + throw new Error('randomWinner unset during path building task'); + } otherNodes = otherNodes.filter(n => { return n.pubkey_ed25519 !== randomWinner?.pubkey_ed25519; });