From cfaec7857f9c8dcaee92f62dcc4383ba43aca873 Mon Sep 17 00:00:00 2001 From: kumsil1006 <39304306+kumsil1006@users.noreply.github.com> Date: Fri, 16 Dec 2022 11:19:33 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20timer=20=EB=8F=99=EC=9E=91=20=EC=A4=91?= =?UTF-8?q?=EC=97=90=EB=8A=94=20activeTodo=EC=9D=98=20elapsedTime=EA=B3=BC?= =?UTF-8?q?=20=EB=A7=9E=EC=B6=94=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/main/TodoInteractionButton.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/components/main/TodoInteractionButton.tsx b/client/src/components/main/TodoInteractionButton.tsx index a2a1366..c2c3590 100644 --- a/client/src/components/main/TodoInteractionButton.tsx +++ b/client/src/components/main/TodoInteractionButton.tsx @@ -6,7 +6,7 @@ import Button from '@components/Button'; import Postpone from '@images/Postpone'; import Done from '@images/Done'; -import { asyncActiveTodo, elapsedTimeAtom, postponeClicked } from '@util/GlobalState.js'; +import { asyncActiveTodo, elapsedTimeAtom, isOnProgress, postponeClicked } from '@util/GlobalState.js'; import useDone from '@hooks/useDone.js'; import StartPauseButton from '@components/StartPauseButton'; @@ -23,9 +23,10 @@ const TodoInteractionButton = (imageButtonStyle: ImageButtonStyle): ReactElement const [setDone] = useDone(); const [elapsedTime, setElapsedTime] = useAtom(elapsedTimeAtom); const activeTodo = useAtomValue(asyncActiveTodo); + const progressState = useAtomValue(isOnProgress); useEffect(() => { - if (activeTodo !== undefined && activeTodo.elapsedTime !== elapsedTime) { + if (activeTodo !== undefined && activeTodo.elapsedTime !== elapsedTime && progressState !== 'working') { setElapsedTime(activeTodo.elapsedTime); } }, [activeTodo]);