Repository navigation
Conversation
JournalReminderCard attached its .task to a Group whose only child is the card itself, shown once `loggedDays` is loaded. A Group hands its modifiers to its children, and before the first load there is no child, so the task never ran, `loggedDays` stayed nil and the card never appeared on either Today screen, whatever the reminder toggle said. The content now sits in a VStack that exists whenever the reminder is on, so the load always starts; with the reminder off the card still renders nothing. Reproduced on the iOS simulator with demo data (card missing, then present after the change). Android is not affected: JournalReminderCard there loads in a LaunchedEffect after its early return, which always runs.
|
Swept the rest of the tree for this pattern, since the diagnosis generalises past the two cards: a Seven
Two are this card and the auto-detect one (#2766). The seventh has the identical deadlock:
@State private var starts: [String] = [] // :289
private var shouldShow: Bool { // :293
!cycleHidden && (profile.cycleAwarenessApplies || cycleEnabled || !starts.isEmpty)
}
Group { if shouldShow { ... } } // :297, no else
.task(id: repo.cycleTrackingSeq) { starts = await repo.periodStarts() } // :379
The same file carries its own control: Happy to take it here if you want to extend this PR to cover it. Worth noting before you pick a remedy: the empty state at that site is permanent, not a brief pre-load window (cycle awareness off, toggle off, no logged starts is a steady state), so the container approach in this PR would leave a zero-size child holding a slot and its spacing in the Today stack. That puts it closer to the auto-detect card's situation than to this one. One unrelated small thing on this PR: the task id is now built only when |
…n show it `MenstrualCycleHomeCard` is shown when cycle awareness applies, when the toggle is on, or when period starts are logged. The starts were loaded by a `.task` on a `Group` whose only child is the card, so with awareness off and the toggle off there was no child, the task never ran, `starts` stayed empty and the third condition could never become true. That empty state is the steady state for most users, so a placeholder would hold a slot and its spacing in the Today stack. The load now runs in `PeriodStartsLoader`, the same shape as the auto-detect card's loader. Also drop `JournalReminderLoadKey`: the task only exists while the reminder is on, so its `enabled` field was constant and the seq alone is the id. Analysis migration required: no
|
Thanks for the sweep. Took both into this PR in 3875c37.
Checked with a standalone SwiftUI run on macOS (the old shape never calls the load; the loader loads once, the card appears, an empty result leaves the stack height unchanged, a seq bump reloads once) and both app builds. Not yet seen on a device with real logged starts. |
JournalReminderCardattaches its.taskto aGroupwhose only child is the card itself, shown onceloggedDayshas loaded. AGrouphands its modifiers to its children, and before the first load there is no child, so the task never runs,loggedDaysstays nil and the card never appears on either Today screen, whatever the reminder toggle says.The content now sits in a
VStackthat exists whenever the reminder is on, so the load always starts. With the reminder off the card still renders nothing.Verification
mainat e580175: the Journal section is in the default order and not hidden, yet no card appears. With this change the card shows (strip plus "Log today's journal")..taskon aGroup(or anEmptyView) with no child never runs; on an emptyVStackit does.Strandand iOSNOOPiOSbuild.Android is not affected:
JournalReminderCardthere loads in aLaunchedEffectafter its early return, which always runs.Also: the menstrual cycle card (same deadlock)
MenstrualCycleHomeCardshows when cycle awareness applies, when the toggle is on, or when period starts are logged. The starts were loaded by a.taskon the same kind of childlessGroup, so with awareness and toggle off the third condition could never become true. Here the empty state is permanent for most users, so a container would leave a zero-size slot and its spacing in the Today stack. The load now runs inPeriodStartsLoader, the same shape as the loader in #2766.The vestigial
JournalReminderLoadKeyis gone: the task only exists while the reminder is on, so it is keyed onrefreshSeqalone.Strandand iOSNOOPiOSbuild.