diff --git a/src/components/robot/RecordingsTable.tsx b/src/components/robot/RecordingsTable.tsx index eaac87d8..ed2ba033 100644 --- a/src/components/robot/RecordingsTable.tsx +++ b/src/components/robot/RecordingsTable.tsx @@ -23,6 +23,7 @@ import { ListItemText, FormControlLabel, Checkbox, + CircularProgress, } from "@mui/material"; import { Schedule, @@ -154,6 +155,7 @@ export const RecordingsTable = ({ const [searchTerm, setSearchTerm] = React.useState(''); const [isWarningModalOpen, setWarningModalOpen] = React.useState(false); const [activeBrowserId, setActiveBrowserId] = React.useState(''); + const [isLoading, setIsLoading] = React.useState(true); const columns = useMemo(() => [ { id: 'interpret', label: t('recordingtable.run'), minWidth: 80 }, @@ -270,6 +272,8 @@ export const RecordingsTable = ({ } catch (error) { console.error('Error fetching recordings:', error); notify('error', t('recordingtable.notifications.fetch_error')); + } finally { + setIsLoading(false); } }, [setRecordings, notify, t]); @@ -405,9 +409,7 @@ export const RecordingsTable = ({ } useEffect(() => { - if (rows.length === 0) { - fetchRecordings(); - } + fetchRecordings(); }, [fetchRecordings]); useEffect(() => { @@ -514,7 +516,9 @@ export const RecordingsTable = ({ - {filteredRows.length === 0 ? ( + {isLoading ? ( + + ) : filteredRows.length === 0 ? ( = ({ const [rows, setRows] = useState([]); const [searchTerm, setSearchTerm] = useState(''); + const [isLoading, setIsLoading] = useState(true); const [paginationStates, setPaginationStates] = useState({}); @@ -224,6 +225,8 @@ export const RunsTable: React.FC = ({ } } catch (error) { notify('error', t('runstable.notifications.fetch_error')); + } finally { + setIsLoading(false); } }, [notify, t]); @@ -231,6 +234,7 @@ export const RunsTable: React.FC = ({ let mounted = true; if (rows.length === 0 || rerenderRuns) { + setIsLoading(true); fetchRuns().then(() => { if (mounted) { setRerenderRuns(false); @@ -378,7 +382,9 @@ export const RunsTable: React.FC = ({ /> - {Object.keys(groupedRows).length === 0 ? ( + {isLoading? ( + + ) : Object.keys(groupedRows).length === 0 ? (