Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Recreate MenuBarTimelineView task after view re-init
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Apr 23, 2024
1 parent 5b99194 commit e453dc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Aware/macOS/MenuBarTimelineView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ struct MenuBarTimelineView<Schedule, Content>: View
let schedule: Schedule
let content: (MenuBarTimelineViewDefaultContext) -> Content

private let startDate = Date()

@State private var context: MenuBarTimelineViewDefaultContext = .init(date: .now)

init(
Expand All @@ -29,8 +31,8 @@ struct MenuBarTimelineView<Schedule, Content>: View

var body: some View {
content(context)
.task {
for date in schedule.entries(from: .now, mode: .normal) {
.task(id: startDate) {
for date in schedule.entries(from: startDate, mode: .normal) {
let duration: Duration = .init(timeInterval: date.timeIntervalSinceNow)
if duration > .zero {
do {
Expand Down

0 comments on commit e453dc5

Please sign in to comment.