diff options
| author | Oskar <oskar@mullvad.net> | 2024-10-22 15:32:24 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2024-10-22 15:32:24 +0200 |
| commit | 1ec8c9d6c4dc799fb0c6479cdc9dad438bf37129 (patch) | |
| tree | 43caf1e9884496f64c2333648c16381eaa1cf18a /gui/src/renderer/components/AppButton.tsx | |
| parent | 6533665d1fdf9a97e6ea1e36f01ee2f293b4338c (diff) | |
| parent | cf62ffdd17eac7958977895f098742c704aa3047 (diff) | |
| download | mullvadvpn-1ec8c9d6c4dc799fb0c6479cdc9dad438bf37129.tar.xz mullvadvpn-1ec8c9d6c4dc799fb0c6479cdc9dad438bf37129.zip | |
Merge branch 'add-react-linter-rules'
Diffstat (limited to 'gui/src/renderer/components/AppButton.tsx')
| -rw-r--r-- | gui/src/renderer/components/AppButton.tsx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gui/src/renderer/components/AppButton.tsx b/gui/src/renderer/components/AppButton.tsx index 753f64745e..f82b997cc4 100644 --- a/gui/src/renderer/components/AppButton.tsx +++ b/gui/src/renderer/components/AppButton.tsx @@ -3,7 +3,7 @@ import styled from 'styled-components'; import { colors } from '../../config.json'; import log from '../../shared/logging'; -import { useMounted } from '../lib/utilityHooks'; +import { useMounted } from '../lib/utility-hooks'; import { StyledButtonContent, StyledHiddenSide, @@ -127,13 +127,15 @@ interface IBlockingProps { } export function BlockingButton(props: IBlockingProps) { + const { onClick: propsOnClick } = props; + const isMounted = useMounted(); const [isBlocked, setIsBlocked] = useState(false); const onClick = useCallback(async () => { setIsBlocked(true); try { - await props.onClick(); + await propsOnClick(); } catch (error) { log.error(`onClick() failed - ${error}`); } @@ -141,7 +143,7 @@ export function BlockingButton(props: IBlockingProps) { if (isMounted()) { setIsBlocked(false); } - }, [props.onClick]); + }, [isMounted, propsOnClick]); const contextValue = useMemo( () => ({ |
