fix: Liquid Glass month title updates via @Observable store (visibleMonth)

The system NavigationStack toolbar title would not refresh on a plain @State
change (title kept disappearing on iPhone). Moved visibleMonth into the
@Observable CalendarStore so the toolbar's read is tracked with @Observable's
fine-grained observation and refreshes on month change. Reverted the @State/.id
workaround. Real system glass bar retained.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-06-01 19:06:53 +02:00
parent 51218b9aa3
commit 451d3d4d6b
3 changed files with 13 additions and 17 deletions

View File

@@ -19,7 +19,6 @@ struct MonthView: View {
let onCreateEvent: (Date) -> Void
let onShowWeek: (Date) -> Void
let onShowDay: (Date) -> Void
@Binding var visibleMonth: Date
@AppStorage("appLanguage") private var appLang = "system"
@AppStorage("monthDividerColor") private var dividerHex = "#7090c0"
@@ -117,8 +116,8 @@ struct MonthView: View {
private func publishVisibleMonth(from week: Date?) {
guard let w = week else { return }
let month = cal.date(from: cal.dateComponents([.year, .month], from: w)) ?? w
if visibleMonth != month {
visibleMonth = month
if store.visibleMonth != month {
store.visibleMonth = month
}
}
}