fix: commit premium field value before order submission#555
Conversation
When submitting an order immediately after typing the premium value
(within the 2s debounce window), the premium was sent as 0 because
PremiumSection had not yet fired onChanged to the parent.
Calling primaryFocus?.unfocus() at the start of _submitOrder()
synchronously triggers the FocusNode listener, which cancels the
debounce timer and calls _commitTextValue() → widget.onChanged() →
setState({ _premiumValue = value }) before the Order object is built.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdded Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
When submitting an order immediately after typing the premium value (within the 2s debounce window), the premium was sent as 0 because PremiumSection had not yet fired onChanged to the parent.
Calling primaryFocus?.unfocus() at the start of _submitOrder() synchronously triggers the FocusNode listener, which cancels the debounce timer and calls _commitTextValue() → widget.onChanged() → setState({ _premiumValue = value }) before the Order object is built.
Closes #554
Summary by CodeRabbit