diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-10-03 13:22:56 +0200 |
|---|---|---|
| committer | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-10-06 10:02:52 +0200 |
| commit | a7b0f0dec989d17e18e11283f427158ef04c4f7f (patch) | |
| tree | 02193ada94dff6ebe3723124a02fa1a811815f27 | |
| parent | 430e860b6e267f767c06edba0e7a2e4ef793cc4e (diff) | |
| download | mullvadvpn-a7b0f0dec989d17e18e11283f427158ef04c4f7f.tar.xz mullvadvpn-a7b0f0dec989d17e18e11283f427158ef04c4f7f.zip | |
Fix app not launched by Linux split tunneling warning dialog button
The bug occurred because when the Launch button was clicked it called
the returned function from the useLaunchApplication hook. However, that
hook should only be used when the application list item is clicked,
since it is what opens the warning dialog in the first place.
Instead, the Launch button should call the onSelect function from the
LinuxApplicationRow context directly, and then hide the warning dialog.
This bug was introduced when the Split tunnel component was refactored.
See: https://github.com/mullvad/mullvadvpn-app/pull/8708
3 files changed, 17 insertions, 3 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/LaunchButton.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/LaunchButton.tsx index 58c82d4c42..5f9262cd1f 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/LaunchButton.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/LaunchButton.tsx @@ -1,12 +1,12 @@ import { messages } from '../../../../../../../../../../../../../../shared/gettext'; import { Button } from '../../../../../../../../../../../../../lib/components'; -import { useLaunchApplication } from '../../../../hooks'; +import { useHandleClick } from './hooks'; export function LaunchButton() { - const launchApplication = useLaunchApplication(); + const handleClick = useHandleClick(); return ( - <Button onClick={launchApplication}> + <Button onClick={handleClick}> <Button.Text> { // TRANSLATORS: Button label for launching an application with split tunneling. diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/hooks/index.ts b/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/hooks/index.ts new file mode 100644 index 0000000000..ea402d648a --- /dev/null +++ b/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/hooks/index.ts @@ -0,0 +1 @@ +export * from './useHandleClick'; diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/hooks/useHandleClick.ts b/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/hooks/useHandleClick.ts new file mode 100644 index 0000000000..cbbd92bdfc --- /dev/null +++ b/desktop/packages/mullvad-vpn/src/renderer/components/views/split-tunneling/components/linux-settings/components/linux-application-list/components/linux-application-row/components/warning-dialog/components/launch-button/hooks/useHandleClick.ts @@ -0,0 +1,13 @@ +import { useCallback } from 'react'; + +import { useLinuxApplicationRowContext } from '../../../../../LinuxApplicationRowContext'; + +export function useHandleClick() { + const { application, onSelect, setShowWarningDialog } = useLinuxApplicationRowContext(); + const handleClick = useCallback(() => { + setShowWarningDialog(false); + onSelect?.(application); + }, [application, onSelect, setShowWarningDialog]); + + return handleClick; +} |
