fix: Switch/toggle fields never trigger form auto-save - #1420
Conversation
|
Someone is attempting to deploy a commit to the Meshtastic Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughDynamicForm now reports blocked validation saves and exposes an imperative auto-save callback. ToggleInput uses this callback for non-native switch changes while preventing duplicate submissions. Tests cover mouse, keyboard, native input, context, and missing-callback behavior. ChangesForm auto-save flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to Toggle changes now autosave through the existing configuration path, but a rejected validation can leave the displayed toggle out of sync with the device configuration when the related error is not visible. The PR is mergeable with explicit owner awareness and follow-up to surface failed saves clearly. Sequence Diagram(s)sequenceDiagram
participant User
participant ToggleInput
participant DynamicForm
participant onSubmit
User->>ToggleInput: Toggle switch
ToggleInput->>DynamicForm: Invoke autoSave
DynamicForm->>DynamicForm: Validate and submit
DynamicForm->>onSubmit: Pass updated form values
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description clearly explains the problem, the implementation, and verification results. It omits several template sections, including Related Issues, Changes Made, Screenshots, and Checklist, but it contains the critical information needed to understand and review the change.
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
feda27c to
be03324
Compare
Toggle switches throughout the app (Region, MQTT enabled, Bluetooth, channel uplink/downlink, etc.) appeared to save when clicked, but the change was never actually submitted to the device. The Switch component's onCheckedChange only updated local React state - it never produced anything that the form's auto-save-on-change wiring was listening for, so the value change never triggered a submit. Added explicit save-trigger wiring (formAutoSave.ts, DynamicForm.tsx) so a toggle click reliably fires the same submit path as any other form field change. Verified: new test confirms a toggle click now fires exactly one save with the correct value, in both directions (on and off).
be03324 to
ee7ae73
Compare
Problem
Toggle switches throughout the app (Region, MQTT enabled, Bluetooth, channel uplink/downlink, etc.) appear to save when clicked, but the change is never actually submitted to the device. The
Switchcomponent'sonCheckedChangeonly updates local React state — it doesn't produce anything the form's auto-save-on-change wiring is listening for, so the value change never triggers a submit.Fix
Added explicit save-trigger wiring (
formAutoSave.ts, updates toDynamicForm.tsx) so a toggle click reliably fires the same submit path as any other form field change.Verification
Summary by CodeRabbit
New Features
Bug Fixes