diff --git a/agenta-web/src/components/Playground/ViewNavigation.tsx b/agenta-web/src/components/Playground/ViewNavigation.tsx index 489ebd2c17..f0d9008b97 100644 --- a/agenta-web/src/components/Playground/ViewNavigation.tsx +++ b/agenta-web/src/components/Playground/ViewNavigation.tsx @@ -84,6 +84,7 @@ const ViewNavigation: React.FC = ({ const stopperRef = useRef(null) const [isDelayed, setIsDelayed] = useState(false) const [loading, setLoading] = useState(false) + const [isLogsLoading, setIsLogsLoading] = useState(false) let prevKey = "" const showNotification = (config: Parameters[0]) => { @@ -123,9 +124,22 @@ const ViewNavigation: React.FC = ({ } if (isError) { + setLoading(false) const getLogs = async () => { - const logs = await fetchVariantLogs(variant.variantId) - setVariantErrorLogs(logs) + try { + setIsLogsLoading(true) + const logs = await fetchVariantLogs(variant.variantId) + setVariantErrorLogs(logs) + } catch (error) { + console.error(error) + showNotification({ + type: "error", + message: "Variant logs unreachable", + description: `Unable to fetch variant logs.`, + }) + } finally { + setIsLogsLoading(false) + } } getLogs() } @@ -215,7 +229,11 @@ const ViewNavigation: React.FC = ({ const apiAddress = `${containerURI}/openapi.json` return (
- {error ? ( + {!error ? null : isLogsLoading ? ( +
+ +
+ ) : (

Error connecting to the variant {variant.variantName}.{" "} @@ -276,7 +294,7 @@ const ViewNavigation: React.FC = ({

- ) : null} + )}
) }