Aug 19 - Fixed photo-loss issue
This commit is contained in:
@@ -162,6 +162,14 @@ struct InspectionHistoryView: View {
|
||||
filterToDate = nil
|
||||
showFilterSheet = false
|
||||
Task { await load(reset: true) }
|
||||
} onCancel: {
|
||||
// Discard the draft edits, keep whatever is currently applied,
|
||||
// and do NOT reload — backing out must change nothing.
|
||||
draftFromEnabled = filterFromDate != nil
|
||||
draftToEnabled = filterToDate != nil
|
||||
if let f = filterFromDate { draftFromDate = f }
|
||||
if let t = filterToDate { draftToDate = t }
|
||||
showFilterSheet = false
|
||||
}
|
||||
}
|
||||
.task {
|
||||
@@ -215,6 +223,10 @@ struct DateFilterSheet: View {
|
||||
@Binding var toDate: Date
|
||||
let onApply: () -> Void
|
||||
let onClear: () -> Void
|
||||
/// Dismiss without touching the active filter. Distinct from `onClear`:
|
||||
/// Cancel used to call that, so backing out of the sheet silently wiped
|
||||
/// whatever date range was already applied and reloaded the list.
|
||||
let onCancel: () -> Void
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
@@ -243,7 +255,7 @@ struct DateFilterSheet: View {
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button("Cancel") { onClear() }
|
||||
Button("Cancel") { onCancel() }
|
||||
}
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button("Apply", action: onApply)
|
||||
|
||||
Reference in New Issue
Block a user