Skip to content

Commit

Permalink
fix: Show pending trade dialog immediately when submitting an order
Browse files Browse the repository at this point in the history
Otherwise, a short delay could happen after submitting the order before the dialog is shown. This was more obvious on the test vm the other day, when the submit order request timed out.
  • Loading branch information
holzeis committed May 8, 2024
1 parent f0f2710 commit 2556c0e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mobile/native/src/trade/order/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ pub async fn submit_order(
order: Order,
channel_opening_params: Option<ChannelOpeningParams>,
) -> Result<Uuid, SubmitOrderError> {
event::publish(&EventInternal::BackgroundNotification(
BackgroundTask::AsyncTrade(TaskStatus::Pending),
));

submit_order_internal(order, channel_opening_params)
.await
.inspect_err(report_error_to_coordinator)
Expand Down Expand Up @@ -129,10 +133,6 @@ pub async fn submit_order_internal(
set_order_to_open_and_update_ui(order.id).map_err(SubmitOrderError::Storage)?;
update_position_after_order_submitted(&order).map_err(SubmitOrderError::Storage)?;

event::publish(&EventInternal::BackgroundNotification(
BackgroundTask::AsyncTrade(TaskStatus::Pending),
));

Ok(order.id)
}

Expand Down

0 comments on commit 2556c0e

Please sign in to comment.