Exercises management fixed

This commit is contained in:
AG
2025-11-25 22:53:41 +02:00
parent fe2883608c
commit e3efc84250
2 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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 () => {