From d0fc13a0e407ee1fbef6c145a0adc50e49a3a5d0 Mon Sep 17 00:00:00 2001 From: Kaosiso Ezealigo Date: Mon, 20 May 2024 22:51:13 +0100 Subject: [PATCH] improved logic --- agenta-web/src/components/Playground/ViewNavigation.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/agenta-web/src/components/Playground/ViewNavigation.tsx b/agenta-web/src/components/Playground/ViewNavigation.tsx index da5a9840c6..59dfaff055 100644 --- a/agenta-web/src/components/Playground/ViewNavigation.tsx +++ b/agenta-web/src/components/Playground/ViewNavigation.tsx @@ -83,6 +83,7 @@ const ViewNavigation: React.FC = ({ const [isDrawerOpen, setIsDrawerOpen] = useState(false) const stopperRef = useRef(null) const [isDelayed, setIsDelayed] = useState(false) + const [loading, setLoading] = useState(false) let prevKey = "" const showNotification = (config: Parameters[0]) => { @@ -136,15 +137,16 @@ const ViewNavigation: React.FC = ({ }, [netWorkError, isError, variant.variantId]) useEffect(() => { - if (retrying) { + if (retrying && variantErrorLogs) { const timeout = setTimeout(() => { setIsDelayed(true) }, 6000) return () => clearTimeout(timeout) } - }, [retrying]) + }, [retrying, variantErrorLogs]) const handleStopPolling = () => { + setLoading(true) if (stopperRef.current) { stopperRef.current() } @@ -161,7 +163,7 @@ const ViewNavigation: React.FC = ({ title="This is taking longer than expected" spinner={retrying} /> -