Skip to content

Commit 20cd283

Browse files
committed
refactor(frontend): simplify exercise addition navigation logic
- Remove unnecessary fragment navigation - Eliminate unused exercise index tracking - Streamline navigation to fitness action route
1 parent 4ad248a commit 20cd283

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

apps/frontend/app/lib/state/fitness.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { atomWithStorage } from "jotai/utils";
2323
import type { NavigateFunction } from "react-router";
2424
import { $path } from "safe-routes";
2525
import { match } from "ts-pattern";
26-
import { withFragment } from "ufo";
2726
import { v4 as randomUUID } from "uuid";
2827
import {
2928
CURRENT_WORKOUT_KEY,
@@ -386,7 +385,6 @@ export const addExerciseToCurrentWorkout = async (
386385
selectedExercises: Array<{ name: string; lot: ExerciseLot }>,
387386
) => {
388387
const draft = createDraft(currentWorkout);
389-
const idxOfNextExercise = draft.exercises.length;
390388
for (const [_exerciseIdx, ex] of selectedExercises.entries()) {
391389
const exerciseDetails = await getExerciseDetails(ex.name);
392390
const setLot = SetLot.Normal;
@@ -431,12 +429,5 @@ export const addExerciseToCurrentWorkout = async (
431429
}
432430
const finishedDraft = finishDraft(draft);
433431
setCurrentWorkout(finishedDraft);
434-
navigate(
435-
withFragment(
436-
$path("/fitness/:action", {
437-
action: currentWorkout.currentAction,
438-
}),
439-
idxOfNextExercise.toString(),
440-
),
441-
);
432+
navigate($path("/fitness/:action", { action: currentWorkout.currentAction }));
442433
};

0 commit comments

Comments
 (0)