Skip to content

Commit

Permalink
fix(com-pwa): fix the rendering issue after registering a new order a…
Browse files Browse the repository at this point in the history
…nd then go to show its details
  • Loading branch information
mohammadhonarvar authored and alimd committed Apr 19, 2023
1 parent c6cf963 commit f35593f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions uniquely/com-pwa/src/manager/controller/new-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -180,7 +185,6 @@ finiteStateMachineProvider.defineActions<NewOrderFsm>('new_order_fsm', {

routing: (fsmInstance) => {
const {orderId, orderStorage} = fsmInstance.getContext();
console.warn({orderId, orderStorage});
if (orderId === 'new') {
fsmInstance.transition('new_order');
}
Expand Down Expand Up @@ -331,6 +335,12 @@ finiteStateMachineProvider.defineSignals<NewOrderFsm>('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,
Expand Down

0 comments on commit f35593f

Please sign in to comment.