diff --git a/web/src/pages/Logs.tsx b/web/src/pages/Logs.tsx index bcd3430e4..1514bbf8f 100644 --- a/web/src/pages/Logs.tsx +++ b/web/src/pages/Logs.tsx @@ -33,6 +33,7 @@ function Logs() { const [filterSeverity, setFilterSeverity] = useState(); const [selectedLog, setSelectedLog] = useState(); const lazyLogRef = useRef(null); + const [isLoading, setIsLoading] = useState(true); useEffect(() => { document.title = `${logService[0].toUpperCase()}${logService.substring(1)} Logs - Frigate`; @@ -69,6 +70,7 @@ function Logs() { // fetchers const fetchInitialLogs = useCallback(async () => { + setIsLoading(true); try { const response = await axios.get(`logs/${logService}`); if ( @@ -85,6 +87,8 @@ function Logs() { toast.error(`Error fetching logs: ${errorMessage}`, { position: "top-center", }); + } finally { + setIsLoading(false); } }, [logService, filterLines]); @@ -159,6 +163,8 @@ function Logs() { }, [logService, filterSeverity]); useEffect(() => { + setIsLoading(true); + setLogs([]); fetchInitialLogs().then(() => { // Start streaming after initial load setIsStreaming(true); @@ -454,24 +460,28 @@ function Logs() {
- ( - } - /> - )} - /> + {isLoading ? ( + + ) : ( + ( + } + /> + )} + /> + )}