Skip to content

fix(today): run the auto-detect scan, so "looks like a workout?" can appear - #2766

Open
DX23876 wants to merge 1 commit into
ryanbr:mainfrom
DX23876:fix/auto-workout-card-scan
Open

DX23876 wants to merge 1 commit into
ryanbr:mainfrom
DX23876:fix/auto-workout-card-scan

Conversation

@DX23876

@DX23876 DX23876 commented Oct 10, 2026

Copy link
Copy Markdown

AutoWorkoutCard runs its scan from a .task on a Group whose only child is the card, shown once a candidate exists. SwiftUI never runs a .task attached to a Group with no child, so the scan never starts and the prompt never appears on any Today screen, even with "Auto-detect workouts" switched on. Same root cause as #2765 (journal card).

A placeholder view would start the task but is no fix here: whenever the detector finds nothing it would sit in the Today stack and add its spacing. The scan now runs in AutoWorkoutCandidateLoader, an ObservableObject the card's body hands the current key (refresh sequence, toggle). It ignores an unchanged key and publishes from its task, never during the view update. Save, dismiss and the "new window resets the session guard" rule behave as before.

Verification

  • A standalone SwiftUI check on macOS: .task on a Group (or an EmptyView) with no child never runs; an empty VStack or a zero-size view runs it but adds the stack's spacing.
  • The same check with this loader pattern: the load starts, the card appears once a candidate arrives (stack 32 → 94 pt), and with no candidate the stack keeps its height (32 pt, no gap).
  • macOS Strand and iOS NOOPiOS build.
  • Not seen with a real candidate on a device: the demo data has no window the detector picks up.

…appear

AutoWorkoutCard ran its scan from a .task on a Group whose only child is the
card, shown once a candidate exists. SwiftUI never runs a .task attached to a
Group with no child, so the scan never started and the prompt never appeared
on any Today screen, even with "Auto-detect workouts" switched on.

A placeholder view would start the task but is no fix here: whenever the
detector finds nothing it would sit in the Today stack and add its spacing. The
scan now runs in AutoWorkoutCandidateLoader, an ObservableObject the card's body
hands the current key (refresh sequence, toggle); it ignores an unchanged key
and publishes from its task, never during the view update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant