Exercises management fixed
This commit is contained in:
@@ -70,7 +70,7 @@ const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, ac
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const exList = await getExercises(userId);
|
||||
setExercises(exList.filter(e => !e.isArchived));
|
||||
setExercises(exList.filter(e => !e.isArchived || (activePlan && activePlan.steps.some(s => s.exerciseId === e.id))));
|
||||
const planList = await getPlans(userId);
|
||||
setPlans(planList);
|
||||
|
||||
@@ -81,7 +81,7 @@ const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, ac
|
||||
}
|
||||
};
|
||||
loadData();
|
||||
}, [activeSession, userId, userWeight]);
|
||||
}, [activeSession, userId, userWeight, activePlan]);
|
||||
|
||||
// Timer Logic
|
||||
useEffect(() => {
|
||||
@@ -115,7 +115,7 @@ const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, ac
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [activeSession, activePlan, currentStepIndex, exercises]);
|
||||
}, [activeSession, activePlan, currentStepIndex, exercises, selectedExercise]);
|
||||
|
||||
useEffect(() => {
|
||||
const updateSelection = async () => {
|
||||
|
||||
Reference in New Issue
Block a user