From a9367cd53b1229bf8abf9225ca177d387f30ac9b Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sun, 18 Feb 2024 00:36:00 +1300 Subject: [PATCH] Select first item in plan --- StartPlan.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/StartPlan.tsx b/StartPlan.tsx index 88a1cbe..eac1312 100644 --- a/StartPlan.tsx +++ b/StartPlan.tsx @@ -31,7 +31,7 @@ export default function StartPlan() { const [reps, setReps] = useState(params.first?.reps.toString() || "0"); const [weight, setWeight] = useState(params.first?.weight.toString() || "0"); const [unit, setUnit] = useState(params.first?.unit || "kg"); - const [selected, setSelected] = useState(null); + const [selected, setSelected] = useState(0); const [settings, setSettings] = useState(); const [counts, setCounts] = useState(); const weightRef = useRef(null); @@ -88,10 +88,6 @@ export default function StartPlan() { useCallback(() => { settingsRepo.findOne({ where: {} }).then(setSettings); refresh(); - setRepo.find({ order: { created: "DESC" }, take: 1 }).then(sets => { - const index = exercises.findIndex(exercise => exercise === sets[0].name); - setSelected(index === -1 ? 0 : index); - }); // eslint-disable-next-line }, []) );