Toggle selecting all for Plans and Workouts
This commit is contained in:
parent
ec72824e3c
commit
9ae311b94a
|
@ -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 (
|
||||
<>
|
||||
|
|
|
@ -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));
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user