Only put delete if not sent logic in one place

This commit is contained in:
Benjamin Faershtein 2025-05-05 22:40:14 -07:00
parent afa5789fdf
commit 46e0757f03

View file

@ -183,16 +183,6 @@ struct WaypointForm: View {
.padding(.bottom)
Button(role: .cancel) {
if waypoint.id == 0 {
// New, unsent waypoint created by the user: delete it
bleManager.context.delete(waypoint)
do {
try bleManager.context.save()
} catch {
bleManager.context.rollback()
Logger.mesh.error("Failed to save context on waypoint deletion: \(error)")
}
}
dismiss()
} label: {
Label("Cancel", systemImage: "x.circle")