fix(ui): check for activeSitre before checking for sessions

This commit is contained in:
Shekar Siri 2023-07-10 13:41:29 +02:00
parent 206d56e041
commit 58624687c6

View file

@ -118,7 +118,7 @@ function SessionList(props: Props) {
useEffect(() => {
if (!hasNoRecordings) {
if (!hasNoRecordings || !activeSite) {
return;
}
@ -129,7 +129,7 @@ function SessionList(props: Props) {
}, STATUS_FREQUENCY);
return () => clearInterval(sessionStatusTimeOut);
}, [hasNoRecordings]);
}, [hasNoRecordings, activeSite]);
useEffect(() => {
@ -137,12 +137,12 @@ function SessionList(props: Props) {
return;
}
if (statusData.status === 2) { // recording && processed
if (statusData.status === 2 && activeSite) { // recording && processed
props.updateProjectRecordingStatus(activeSite.id, true);
props.fetchSessions(null, true);
clearInterval(sessionStatusTimeOut);
}
}, [statusData]);
}, [statusData, activeSite]);
useEffect(() => {
const id = setInterval(() => {
@ -206,7 +206,7 @@ function SessionList(props: Props) {
return (
<Loader loading={loading}>
{hasNoRecordings && statusData.status >= 1 ? <RecordingStatus data={statusData} /> : (
{hasNoRecordings && statusData.status == 1 ? <RecordingStatus data={statusData} /> : (
<>
<NoContent
title={