05/15 Update: inspector issue view
This commit is contained in:
@@ -125,9 +125,19 @@ struct StartInspectionView: View {
|
||||
}
|
||||
.pickerStyle(.navigationLink)
|
||||
.onChange(of: selectedProjectId) {
|
||||
// Reset downstream selections when contract changes
|
||||
selectedFacilityId = nil
|
||||
selectedAreaId = nil
|
||||
// Reset downstream selections when the user changes contract.
|
||||
// Do NOT reset if the current facilityId already belongs to
|
||||
// the newly selected contract — this covers the pre-fill path
|
||||
// where applyPreFill() sets both projectId and facilityId and
|
||||
// the onChange fires before facilityId is applied, wiping it.
|
||||
let facilityBelongsToContract = facilities.contains {
|
||||
$0.serverId == selectedFacilityId &&
|
||||
$0.projectId == selectedProjectId
|
||||
}
|
||||
if !facilityBelongsToContract {
|
||||
selectedFacilityId = nil
|
||||
selectedAreaId = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user