Survive deleted-and-saved @Models on the started-run navigation path

TestFlight 2.3 (125) "crashed when watch ended an exercise": the
isDeleted guard from 85e1582 only covers the delete→save window. Once
the deletion is saved the model unregisters — isDeleted reads false
again, modelContext goes nil, and any persisted-property read still
traps (_InitialBackingData.getValue). StartedWorkoutNavigator retained
the run's @Model in @State for the whole workout, so an observer
remove/re-add churn (e.g. iCloud reachability flapping) invalidated it
underneath the pushed screen, and the watch's completion push triggered
the rebuild that read it.

Two layers: the fromLive/SplitDetailView guards now also require a
non-nil modelContext, and StartedWorkoutNavigator pushes a plain id
route, re-fetching the entity fresh on every destination build — a
re-imported run resolves to its live instance; a gone run shows a
placeholder instead of trapping.

Claude-Session: https://claude.ai/code/session_01PVNBVKp5bcq52X722uMjwT
This commit is contained in:
2026-07-10 11:32:52 -04:00
parent 372b5dfb4d
commit 5c201289fb
4 changed files with 38 additions and 9 deletions
+2
View File
@@ -1,5 +1,7 @@
**July 2026**
Finishing an exercise from the watch no longer risks crashing the workout screen on the iPhone.
Deleting a workout no longer crashes the app.
While you rest between exercises, the workout screen now previews the next exercise's figure and name so you can see what's coming up.