summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOliver <oliver@mohlin.dev>2024-11-27 15:11:21 +0100
committerJoakim Hulthe <joakim.hulthe@mullvad.net>2024-11-27 16:59:10 +0100
commit3214cfca07c39c6caecd5beac91340dee57f2508 (patch)
treeba018fb2a2ff5698f913965190de9c5b79a5e547
parentf6f84db0a3c89465a68f6033b90f245fa2323384 (diff)
downloadmullvadvpn-3214cfca07c39c6caecd5beac91340dee57f2508.tar.xz
mullvadvpn-3214cfca07c39c6caecd5beac91340dee57f2508.zip
Fix returning location type entry when multihop is disabled
-rw-r--r--desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocationContainer.tsx18
1 files changed, 16 insertions, 2 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocationContainer.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocationContainer.tsx
index 66bebdf1b0..1c4c8e2349 100644
--- a/desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocationContainer.tsx
+++ b/desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocationContainer.tsx
@@ -1,6 +1,7 @@
import React, { useContext, useMemo, useState } from 'react';
import useActions from '../../lib/actionsHook';
+import { useNormalRelaySettings } from '../../lib/relay-settings-hooks';
import { useSelector } from '../../redux/store';
import userInterface from '../../redux/userinterface/actions';
import { RelayListContextProvider } from './RelayListContext';
@@ -23,12 +24,25 @@ export function useSelectLocationContext() {
}
export default function SelectLocationContainer() {
- const locationType = useSelector((state) => state.userInterface.selectLocationView);
+ const locationTypeSelector = useSelector((state) => state.userInterface.selectLocationView);
const { setSelectLocationView } = useActions(userInterface);
const [searchTerm, setSearchTerm] = useState('');
+ const relaySettings = useNormalRelaySettings();
+
+ const locationType = useMemo(() => {
+ if (relaySettings?.wireguard.useMultihop) {
+ return locationTypeSelector;
+ }
+ return LocationType.exit;
+ }, [locationTypeSelector, relaySettings]);
const value = useMemo(
- () => ({ locationType, setLocationType: setSelectLocationView, searchTerm, setSearchTerm }),
+ () => ({
+ locationType,
+ setLocationType: setSelectLocationView,
+ searchTerm,
+ setSearchTerm,
+ }),
[locationType, searchTerm, setSelectLocationView],
);