chore: made last page access more sensible
still didnt work with CB ref: N25B-400
This commit is contained in:
@@ -24,17 +24,24 @@ const MonitoringPage: React.FC = () => {
|
|||||||
|
|
||||||
const [phaseIndex, setPhaseIndex] = React.useState(0);
|
const [phaseIndex, setPhaseIndex] = React.useState(0);
|
||||||
|
|
||||||
const isFinished = phaseIndex >= phaseIds.length; //determines if experiment is over
|
//see if we reached end node
|
||||||
|
const [isFinished, setIsFinished] = React.useState(false);
|
||||||
|
|
||||||
const handleStreamUpdate = React.useCallback((data: any) => {
|
const handleStreamUpdate = React.useCallback((data: any) => {
|
||||||
// Check for phase updates
|
// Check for phase updates
|
||||||
if (data.type === 'phase_update' && data.phase_id) {
|
if (data.type === 'phase_update' && data.phase_id) {
|
||||||
const allIds = getPhaseIds();
|
if (data.phase_id === "end") {
|
||||||
const newIndex = allIds.indexOf(data.phase_id);
|
setIsFinished(true);
|
||||||
if (newIndex !== -1) {
|
} else {
|
||||||
setPhaseIndex(newIndex);
|
setIsFinished(false);
|
||||||
setGoalIndex(0); //when phase change we reset the index
|
|
||||||
}
|
const allIds = getPhaseIds();
|
||||||
|
const newIndex = allIds.indexOf(data.phase_id);
|
||||||
|
if (newIndex !== -1) {
|
||||||
|
setPhaseIndex(newIndex);
|
||||||
|
setGoalIndex(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (data.type === 'goal_update') {
|
else if (data.type === 'goal_update') {
|
||||||
const currentPhaseGoals = getGoalsInPhase(phaseIds[phaseIndex]) as any[];
|
const currentPhaseGoals = getGoalsInPhase(phaseIds[phaseIndex]) as any[];
|
||||||
|
|||||||
Reference in New Issue
Block a user