Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Original issue: we had a listener for the different order statuses on the swap widget. That meant that if the user would leave the widget page he wouldn’t receive any notifications about the order. What is even worse - the user would be on the transaction page, would see the order updating and later when navigating to the widget he would now see a notification for that order. Solution: I’ve changed the way we deal with events. Instead of directly dispatching a notification whenever we receive a new event from the widget, we now store those order updates in the redux state. We update those orders based on our txHistory and on the widget updates we receive. The middleware that listens on those updates has access to the state prior to the state update and can decide if a notification needs to be shown to the user or not. fix: rename swap to order You can have swap or limit orders. Unfortunately it is a bit complicated to know whether the current order is a swap or limit order, so we are going to use the generic order. fix: type in notification title feat: delete swap order We are persisting the order slice and if the users are making a lot of orders it can grow quite a lot. Since right now we are mainly interested in the state in order to show correct notifications, we can optimise and delete the order if the state is fulfilled, cancelled or expired. Those are final states - the next time we see them from the txHistory we can ignore them, if our redux state doesn’t have a created, open or presignaturePending state. If the previous state is undefined - this means that we are not interested in those final states and can ignore them. . fix: failing swap slice test feat: change notification variant for success swap fix: state was not always cleaned up
- Loading branch information