Back to Blocks

Claude Terminal
Loading...
PXL-725Done
Urgent
🪄 Fix setup form issues
Assignee
Ahmed Khalaf
b2-herawizardui/ux
Fixes bugs in the setup wizard where your inputs weren't being saved correctly.
> Technical Details
Unable to update maintenance settings in the wizard form and persist changes. This appears to be a broader issue affecting multiple areas of the wizard flows.
- ●Investigate and fix maintenance settings update issue: The maintenance settings form in the wizard is not properly updating/persisting changes when the user submits the form. Debug the data flow to identify where the update is failing.
- ●Audit all wizard forms: Systematically review all wizard flows in the app to identify any other areas that may have similar update/persistence issues. Check:
- ●Maintenance settings wizard
- ●Goal setup wizard
- ●Profile setup wizard
- ●Any other multi-step wizard flows
- ●Move cancel confirmation dialogs: Currently, cancel confirmation dialogs are attached to the sheet's dismiss action. This should be refactored so the confirmation dialog is triggered by the cancel button itself, not the sheet dismissal. This provides better UX control and prevents unintended confirmation prompts.
- ●Update all wizard sheets to implement this pattern
- ●Ensure the cancel button triggers the confirmation dialog
- ●Allow sheet dismissal via swipe without triggering confirmation (or handle appropriately based on UX requirements)
- ●This involves wizard/onboarding flows that use sheet presentations
- ●Forms use SwiftUI's form bindings and state management
- ●Need to verify data persistence layer is correctly saving changes
- ●Cancel confirmation dialogs likely use
.confirmationDialogor.alertmodifiers
- ●Maintenance settings can be successfully updated through the wizard form
- ●All wizard flows have been audited and any similar update issues are fixed
- ●Cancel confirmation dialogs are consistently triggered from the cancel button across all wizard sheets
- ●Changes persist correctly after form submission
- ●No regression in existing wizard functionality
Build instruction: Use -destination 'platform=iOS Simulator,name=iPhone 17 Pro' when building this project
Ahmed KhalafJan 12, 2026, 1:10 PM
Test Scenarios for PXL-725
🎯 Critical Test - Body Composition Persistence (Main Bug Fix)
✅ Scenario 1: Katch-McArdle Formula with Body Fat %
- ●Open energy target settings for a day
- ●Click "Use Wizard" (if no target) or edit existing maintenance
- ●Choose "Calculate from Maintenance" → "Calculate from Components"
- ●Resting Energy: Select "BMR Formula"
- ●Select "Katch-McArdle" formula (requires body composition)
- ●Enter weight:
80kg - ●Enter body fat percentage:
15.5% - ●Complete the wizard
- ●Close the energy target sheet completely
- ●Reopen energy target settings for the same day
- ●Click "Maintenance" button to view settings
- ●✅ VERIFY: Body fat % shows
15.5% (not blank/lost) - ●✅ VERIFY: Body composition method is set to "Enter Body Fat %"
✅ Scenario 2: Cunningham Formula with Lean Body Mass
- ●Repeat steps 1-5 above
- ●Select "Cunningham" formula
- ●Enter weight:
75kg - ●Switch to "Lean Body Mass" input
- ●Enter lean body mass:
65.2kg - ●Complete the wizard
- ●Close and reopen energy target settings
- ●Open maintenance settings
- ●✅ VERIFY: Lean body mass shows
65.2kg (not blank) - ●✅ VERIFY: Body composition method is "Enter Lean Body Mass"
📝 Full Configuration Persistence Test
✅ Scenario 3: Components Mode with All Settings
- ●Use wizard: Components mode
- ●Resting Energy: BMR Formula (Mifflin-St Jeor)
- ●Enter: Weight
70kg, Height175cm, Age30, Sex: Male - ●Active Energy: Activity Multiplier → "Moderately Active"
- ●Adjustment: Deficit of
500kcal - ●Complete wizard
- ●Save the target
- ●Close app or navigate away and back
- ●Reopen energy target for that day
- ●Open maintenance settings
- ●✅ VERIFY ALL:
- ●Mode: Components
- ●Resting: BMR Formula (Mifflin-St Jeor)
- ●Weight:
70kg, Height:175cm, Age:30, Sex: Male - ●Active: Activity Multiplier (Moderately Active)
✅ Scenario 4: Energy Balance Mode Persistence
- ●Use wizard: Energy Balance
- ●Select "Last 7 Days"
- ●Complete with calculated value showing
- ●Close and reopen
- ●✅ VERIFY: Energy balance settings and calculated value persist
🚫 Cancel Confirmation Tests (Should Already Work)
✅ Scenario 5: Cancel with Progress
- ●Start energy wizard
- ●Proceed to step 2 or 3
- ●Click "Cancel" button (top left)
- ●✅ VERIFY: Confirmation dialog appears asking "Cancel Setup?"
- ●Click "Continue Setup" → wizard stays open
- ●Click "Cancel" again → "Cancel Setup" → wizard closes
✅ Scenario 6: Cancel on First Step
- ●Open wizard
- ●Immediately click "Cancel" (still on step 1)
- ●✅ VERIFY: Dialog should NOT appear (dismisses immediately)
✅ Scenario 7: Maintenance Sheet Cancel with Changes
- ●Open existing energy target maintenance settings
- ●Change a value (e.g., change weight from 70 to 75)
- ●Click "Cancel"
- ●✅ VERIFY: "Discard Changes?" dialog appears
- ●Test both "Discard" and "Cancel" options work
🔄 Edge Cases to Test
✅ Scenario 8: Switch Between Body Composition Methods
- ●Complete wizard with Katch-McArdle + Body Fat % =
20 - ●Reopen maintenance
- ●Switch to "Enter Lean Body Mass"
- ●Enter LBM:
60kg - ●Click "Set Maintenance"
- ●Reopen
- ●✅ VERIFY: LBM value
60persists (not reverted to body fat)
✅ Scenario 9: Apple Health Sync Body Composition
- ●Use wizard with Katch-McArdle formula
- ●Tap "Sync" button to pull from Apple Health
- ●Complete wizard
- ●Reopen
- ●✅ VERIFY: Synced body composition values persist
⚠️ Known Limitations (May Need Follow-up)
✅ Scenario 10: Macro Wizard Body Mass (May Still Have Issues)
- ●Open Protein target wizard
- ●Choose "Per Body Mass" calculation
- ●If there's an Apple Health sync for body composition data
- ●Complete wizard
- ●✅ CHECK: Does body fat/LBM data persist? (May not - found in audit)
📋 Changes Made
- ●WizardResultApplier.swift: Added body composition field application (leanBodyMass, bodyFatPercent, bodyCompositionMethod)
- ●NutrientTargetSheet.swift: Added MaintenanceConfiguration save after wizard completion
- ●NutrientTargetViewModel.swift: Added
saveMaintenanceConfigurationToDay()method
All cancel confirmation dialogs already use the correct pattern (attached to Cancel button, not sheet dismissal).
Created Dec 12, 2025, 5:58 PM | Updated Jan 16, 2026, 6:09 PM