Fix Order Status Hydration Bug issue #219#220
Conversation
WalkthroughThe update enhances the internal status mapping logic within the Changes
Estimated code review effort2 (~15 minutes) Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
📓 Path-based instructions (2)lib/**/*.dart📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
**/*.dart📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
🧠 Learnings (2)📓 Common learningslib/features/order/models/order_state.dart (3)Learnt from: chebizarro Learnt from: CR Learnt from: chebizarro 🧰 Additional context used📓 Path-based instructions (2)lib/**/*.dart📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
**/*.dart📄 CodeRabbit Inference Engine (CLAUDE.md)
Files:
🧠 Learnings (2)📓 Common learningslib/features/order/models/order_state.dart (3)Learnt from: chebizarro Learnt from: CR Learnt from: chebizarro 🔇 Additional comments (4)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Fixes #219
Orders with cooperative cancellation or dispute were incorrectly showing as pending, waiting-buyer-invoice, or waiting-payment after app restart, instead of their actual cooperative cancellation or dispute states.
Root Cause
The OrderState._getStatusFromAction() method was missing explicit mappings for several critical actions, causing them to fall through to the default case during order hydration from storage when the app restarts.
Solution
Added comprehensive action-to-status mappings for all missing actions:
Critical Fixes:
cooperativeCancelInitiatedByYou/ByPeer → Status.cooperativelyCanceled
disputeInitiatedByYou/ByPeer → Status.dispute
Additional Completeness Fixes:
release → Status.success
cancel → Status.canceled
buyerInvoiceAccepted → Status.active
holdInvoicePaymentCanceled → Status.canceled
Admin actions → appropriate statuses (adminSettle → settledByAdmin, etc.)
Informational actions → preserve current status
Summary by CodeRabbit
New Features
Bug Fixes