Skip to content

Commit

Permalink
Merge pull request #27 from Intrepiware/fix-bugs
Browse files Browse the repository at this point in the history
Fix broken page when invalid workout in localStorage
  • Loading branch information
Intrepiware authored Jan 29, 2024
2 parents 3ccf580 + c209b64 commit 883caaa
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 883caaa

Please sign in to comment.