-
-
Notifications
You must be signed in to change notification settings - Fork 133
Recalculate price on task cancellation #5128
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
Conversation
…and manual supplements preserved)
| taxTotal={event.data.new_tax_total} | ||
| /> | ||
| </div> | ||
| ) : null} |
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.
Maybe the type check should be performed on the TotalPrice component, it'll make OrderHistory.tsx cleaner and TotalPrice more error resilient
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.
Well, these type checks are mostly a workaround to avoid TypeScript warnings, because event.data has type data?: Record<string, unknown>;
I think a better solution is to define types for all possible objects inside event.data (one day 😄 )
| return; | ||
| } | ||
|
|
||
| $this->deliveryManager->calculateRoute($delivery); |
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.
This is prone to throwing :/
- Minimalist approach: wrap this in a try/catch and notify the user that the price could not be recalculated.
- The "Yikes" way: I’ll move this into an async worker job for two reasons:
- The combined cancel-recalculation + route calculation can be quite long (especially the route calculation).
- If calculateRoute throws, I can easily retry the failed job(s).
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.
Done in 238cb77
This reverts commit ea8c62c.
Uh oh!
There was an error while loading. Please reload this page.