Exercises management fixed
This commit is contained in:
@@ -71,8 +71,8 @@ const Profile: React.FC<ProfileProps> = ({ user, onLogout, lang, onLanguageChang
|
|||||||
setAllUsers(getUsers());
|
setAllUsers(getUsers());
|
||||||
};
|
};
|
||||||
|
|
||||||
const refreshExercises = () => {
|
const refreshExercises = async () => {
|
||||||
setExercises(getExercises(user.id));
|
setExercises(await getExercises(user.id));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Snackbar State
|
// Snackbar State
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, ac
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
const exList = await getExercises(userId);
|
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);
|
const planList = await getPlans(userId);
|
||||||
setPlans(planList);
|
setPlans(planList);
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, ac
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
loadData();
|
loadData();
|
||||||
}, [activeSession, userId, userWeight]);
|
}, [activeSession, userId, userWeight, activePlan]);
|
||||||
|
|
||||||
// Timer Logic
|
// Timer Logic
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -115,7 +115,7 @@ const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, ac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [activeSession, activePlan, currentStepIndex, exercises]);
|
}, [activeSession, activePlan, currentStepIndex, exercises, selectedExercise]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const updateSelection = async () => {
|
const updateSelection = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user