From f35593fe1bbdf51549d95407ebe78c92c5c119cf Mon Sep 17 00:00:00 2001 From: Mohammad Honarvar Date: Tue, 18 Apr 2023 02:02:19 +0330 Subject: [PATCH] fix(com-pwa): fix the rendering issue after registering a new order and then go to show its details --- .../com-pwa/src/manager/controller/new-order.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/uniquely/com-pwa/src/manager/controller/new-order.ts b/uniquely/com-pwa/src/manager/controller/new-order.ts index a673b11d3..a85538238 100644 --- a/uniquely/com-pwa/src/manager/controller/new-order.ts +++ b/uniquely/com-pwa/src/manager/controller/new-order.ts @@ -93,7 +93,12 @@ export const newOrderFsmConstructor = finiteStateMachineProvider.defineConstruct on: {}, }, notFound: { - on: {}, + on: { + context_request_complete: { + target: 'routing', + condition: 'is_all_context_ready', + }, + }, }, newOrder: { entry: 'check_item_list', @@ -180,7 +185,6 @@ finiteStateMachineProvider.defineActions('new_order_fsm', { routing: (fsmInstance) => { const {orderId, orderStorage} = fsmInstance.getContext(); - console.warn({orderId, orderStorage}); if (orderId === 'new') { fsmInstance.transition('new_order'); } @@ -331,6 +335,12 @@ finiteStateMachineProvider.defineSignals('new_order_fsm', [ { signalId: orderStorageContextConsumer.id, callback: (_, fsmInstance): void => { + /** + * FIXME: When we click on `showOrderDetail` button(after registering a new order) + * this `callback` will run twice, why? + * It that's why the state will change to `notFound` at the first time and then + * will change to 'orderDetail' + */ const orderStorage = orderStorageContextConsumer.getResponse(); fsmInstance.transition(`context_request_${orderStorageContextConsumer.getState().target}`, { orderStorage,