From 4735b1589b425de7bfbf8ab76f7ce1404575a11c Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Thu, 27 Oct 2022 10:07:02 +1300 Subject: [PATCH] Fix selection for plan starting Old selection index was based on `workouts` new one is based on the `counts`. --- StartPlan.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/StartPlan.tsx b/StartPlan.tsx index 38ea19b..4be2e9c 100644 --- a/StartPlan.tsx +++ b/StartPlan.tsx @@ -88,10 +88,11 @@ export default function StartPlan() { const select = useCallback( async (index: number) => { setSelected(index); - console.log(`${StartPlan.name}.next:`, {name, workouts}); - const workout = workouts[index]; + console.log(`${StartPlan.name}.next:`, {name}); + if (!counts) return; + const workout = counts[index]; console.log(`${StartPlan.name}.next:`, {workout}); - const newBest = await getBestSet(workout); + const newBest = await getBestSet(workout.name); setMinutes(newBest.minutes); setSeconds(newBest.seconds); setName(newBest.name);