diff --git a/CHANGELOG.md b/CHANGELOG.md index b38edcec3930..addd434290e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Line wrap the file at 100 chars. Th ### Fixed - Handle network switching better when using WG over Shadowsocks. +- Fix multihop entry location list sometimes being shown when multihop is disabled. #### macOS - Fix packets being duplicated on LAN when split tunneling is enabled. diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocation.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocation.tsx index d81a265072e3..4f2c830f2811 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocation.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/select-location/SelectLocation.tsx @@ -302,7 +302,7 @@ function SelectLocationContent() { ); } else if (relaySettings?.tunnelProtocol !== 'openvpn') { - if (daita && !directOnly) { + if (daita && !directOnly && relaySettings?.wireguard.useMultihop) { return ; } 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 66bebdf1b0e0..1c4c8e23493f 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], );