diff --git a/CHANGELOG.md b/CHANGELOG.md index b8818c0..e16157a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,3 +20,8 @@ All notable changes to this project are documented here. - Fixed: workout marked complete on creation, an undismissable delete dialog, toolbar buttons hidden by nested navigation stacks, and a placeholder "Settings coming soon" row. +- Fixed: tapping an exercise in a workout log pushed the wrong screen (a + duplicate of the split list) with the exercise detail hidden underneath — a + single row tap was navigating twice. Caused by stacking two + `navigationDestination` modifiers on the log list; rows now use a single + destination-based link. diff --git a/Workouts/Views/WorkoutLogs/WorkoutLogListView.swift b/Workouts/Views/WorkoutLogs/WorkoutLogListView.swift index e9fbcf9..787af62 100644 --- a/Workouts/Views/WorkoutLogs/WorkoutLogListView.swift +++ b/Workouts/Views/WorkoutLogs/WorkoutLogListView.swift @@ -26,9 +26,11 @@ struct WorkoutLogListView: View { @State private var logToDelete: WorkoutLogDocument? @State private var addedLog: AddedLogRoute? - /// Wrapper so the programmatic push after adding an exercise uses a distinct - /// `navigationDestination(item:)` and doesn't collide with the value-based - /// row links registered for `String`. + /// Drives the programmatic push into a freshly-added exercise via + /// `navigationDestination(item:)`. Rows navigate with plain destination-based + /// `NavigationLink`s, so this is the only `navigationDestination` in the view — + /// stacking a second one (e.g. a value-based `for: String.self`) made a single + /// row tap push twice. private struct AddedLogRoute: Identifiable, Hashable { let id: String } init(workout: Workout) { @@ -65,7 +67,9 @@ struct WorkoutLogListView: View { Form { Section(header: Text(label)) { ForEach(sortedLogs) { log in - NavigationLink(value: log.id) { + NavigationLink { + ExerciseView(workout: workout, logID: log.id) + } label: { CheckboxListItem( status: workoutStatus(log).checkboxStatus, title: log.exerciseName, @@ -96,9 +100,6 @@ struct WorkoutLogListView: View { } } } - .navigationDestination(for: String.self) { logID in - ExerciseView(workout: workout, logID: logID) - } .navigationDestination(item: $addedLog) { route in // Seed with our working doc so the brand-new log is available before // the cache catches up.