From 5115c8169b42a931cf587c0818c24dbd1874287c Mon Sep 17 00:00:00 2001 From: koji Date: Fri, 15 Dec 2023 13:15:21 -0500 Subject: [PATCH 1/2] fix(app): fix estop modal button status issue remove useEffect to avoid unexpected state change close RQA-2111 --- .../EmergencyStop/EstopPressedModal.tsx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/src/organisms/EmergencyStop/EstopPressedModal.tsx b/app/src/organisms/EmergencyStop/EstopPressedModal.tsx index 5c80dab272a..0c2b46fdc3d 100644 --- a/app/src/organisms/EmergencyStop/EstopPressedModal.tsx +++ b/app/src/organisms/EmergencyStop/EstopPressedModal.tsx @@ -133,10 +133,7 @@ function DesktopModal({ }: EstopPressedModalProps): JSX.Element { const { t } = useTranslation('device_settings') const [isResuming, setIsResuming] = React.useState(false) - const { - acknowledgeEstopDisengage, - data, - } = useAcknowledgeEstopDisengageMutation() + const { acknowledgeEstopDisengage } = useAcknowledgeEstopDisengageMutation() const handleCloseModal = (): void => { if (setIsDismissedModal != null) { @@ -155,21 +152,18 @@ function DesktopModal({ } const handleClick: React.MouseEventHandler = (e): void => { + e.preventDefault() setIsResuming(true) acknowledgeEstopDisengage({ - onSuccess: () => {}, + onSuccess: () => { + closeModal() + }, onError: () => { setIsResuming(false) }, }) } - React.useEffect(() => { - if (data?.data.status === DISENGAGED) { - closeModal() - } - }, [data?.data.status, closeModal]) - return ( From 380531814649467c533591f5d28d8c847630896b Mon Sep 17 00:00:00 2001 From: koji Date: Fri, 15 Dec 2023 13:18:50 -0500 Subject: [PATCH 2/2] fix linting issue --- app/src/organisms/EmergencyStop/EstopPressedModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/organisms/EmergencyStop/EstopPressedModal.tsx b/app/src/organisms/EmergencyStop/EstopPressedModal.tsx index 0c2b46fdc3d..4c573d4aa6a 100644 --- a/app/src/organisms/EmergencyStop/EstopPressedModal.tsx +++ b/app/src/organisms/EmergencyStop/EstopPressedModal.tsx @@ -26,7 +26,6 @@ import { StyledText } from '../../atoms/text' import { LegacyModal } from '../../molecules/LegacyModal' import { Modal } from '../../molecules/Modal' import { getIsOnDevice } from '../../redux/config' -import { DISENGAGED } from './constants' import type { ModalHeaderBaseProps,