فهرست منبع

Reset basalProfileItems when pump model changes to avoid index out of bound error

Deniz Cengiz 1 سال پیش
والد
کامیت
3a49cd9f2e
1فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  1. 4 0
      Trio/Sources/Modules/Onboarding/View/OnboardingSteps/UnitSelectionStepView.swift

+ 4 - 0
Trio/Sources/Modules/Onboarding/View/OnboardingSteps/UnitSelectionStepView.swift

@@ -30,6 +30,10 @@ struct UnitSelectionStepView: View {
                         Text(pumpModel.displayName).tag(pumpModel)
                     }
                 }
+                .onChange(of: state.pumpOptionForOnboardingUnits, { _, _ in
+                    // Reset basal profile and related values when pump model changes
+                    state.basalProfileItems = []
+                })
             }
             .padding()
             .background(Color.chart.opacity(0.65))