Guard NavigationLink destination inits against deleted @Models

A closure-based NavigationLink builds its destination view eagerly for
every row on every parent-list body evaluation — including the view-graph
update SwiftUI runs the instant SyncEngine.delete does context.delete +
save. Mapping the row's just-deleted @Model to a document there reads a
persisted property on a dead model, which traps in SwiftData
(_InitialBackingData.getValue -> assertionFailure). This is the "Crashed
when deleted a workout" TestFlight report on 2.3 (124).

Add WorkoutDocument(fromLive:) (nil when isDeleted) + a .deletedPlaceholder
and route every destination-init / updatedAt-absorb map through it:
phone WorkoutLogListView + SplitDetailView (read split.id) and watch
WorkoutLogListView. Fixes the whole crash class, not just the report.

Claude-Session: https://claude.ai/code/session_01BQcEWmAPA78338QuEwRkAh
This commit is contained in:
2026-07-10 10:47:10 -04:00
parent 8b20d7ad08
commit 85e15823a3
5 changed files with 49 additions and 6 deletions
+2
View File
@@ -1,5 +1,7 @@
**July 2026**
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.
Spoken cues can now announce the next exercise during a rest and count you into every set with "in 1, 2, 3, GO!".