Skip to content

Commit

Permalink
Fix broken page when invalid workout in localStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
Intrepiware committed Jan 29, 2024
1 parent 3ccf580 commit c209b64
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions WorkoutBuilder/ClientApp/src/Pages/HomeIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ function HomeIndex(props: any) {
);
if (savedWorkout.version === "v1") {
const { workout } = savedWorkout;
setWorkout(savedWorkout);
setUiElements((x) => ({
...x,
timing: workout.name,
focus: workout.focus,
}));
if (workout) {
setWorkout(savedWorkout);
setUiElements((x) => ({
...x,
timing: workout.name,
focus: workout.focus,
}));
}
}
} catch (err) {
console.error(
Expand Down

0 comments on commit c209b64

Please sign in to comment.