Toggle selecting all for Plans and Workouts

This commit is contained in:
Brandon Presley 2023-09-04 13:59:35 +12:00
parent ec72824e3c
commit 9ae311b94a
2 changed files with 3 additions and 1 deletions

View File

@ -86,8 +86,9 @@ export default function PlanList() {
const select = useCallback(() => {
if (!plans) return;
if (ids.length === plans.length) return setIds([]);
setIds(plans.map((plan) => plan.id));
}, [plans]);
}, [plans, ids.length]);
return (
<>

View File

@ -117,6 +117,7 @@ export default function WorkoutList() {
const select = () => {
if (!workouts) return;
if (names.length === workouts.length) return setNames([]);
setNames(workouts.map((workout) => workout.name));
};