-
Notifications
You must be signed in to change notification settings - Fork 120
Update order status in dashboard card #16442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Update order status in dashboard card #16442
Conversation
Generated by 🚫 Danger |
|
|
itsmeichigo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this Rafael! I shared some concerns below.
| guard let index = rows.firstIndex(where: { $0.id == order.orderID }) else { | ||
| return | ||
| } | ||
| rows[index] = LastOrderDashboardRowViewModel(order: order) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check only for relevant updates? Changes like custom fields and customer notes should not affect the row on the card. Maybe check for changes in status, customer name, and cost - basically things that are displayed on the card only?
Also, should we reload the card to get the latest orders if status is changed? Otherwise we'll show orders with mismatched status like this:
Simulator.Screen.Recording.-.iPhone.17.-.2025-12-11.at.09.33.03.mov
|
|
||
| func removeRow(with orderID: Int64) { | ||
| rows.removeAll { $0.id == orderID } | ||
| orderEntityListeners[orderID] = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment as above - we should reload the card to get 3 last orders. If all 3 orders are trashed, the card will be left with no item even though there might be more.

WOOMOB-47
Description
Makes "Most recent orders" dashboard card to reflect order status updates. In the original implementation orders were fetched from API bypassing local storage and were presented in card as-is. Thus the presented orders were detached from the local storage state and didn't reflect any changes.
In this branch the
EntityListenerwas used to track and reflect order changes in dashboard card following the same approach as in #16380. Thx to @itsmeichigo for the suggestion.Orderentity listeners for each order presented in the card.deinitfor safety.Test Steps
Demo
dashboardCardOrderUpdateDemo.mov
RELEASE-NOTES.txtif necessary.