-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Add "Retry" option for failed transactions #7296
Conversation
ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js
Outdated
Show resolved
Hide resolved
Okay, I think this is correct (functionality wise): I did remove some stuff from |
Oh wait, maybe I understand |
@Gudahtt Well, I didn't remember its purpose, but it does The only real use case for that is what you describe: when the sidebar is open for a transaction that goes from pending to either |
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.
Left a few comments, but this is pretty closed to finished.
...ustomization/gas-modal-page-container/advanced-tab-content/advanced-tab-content.component.js
Outdated
Show resolved
Hide resolved
@danjm it seems to me we should just be calling
that will not work in the case of a failed transaction if I am understanding things correctly? |
Maybe... let me think through and edge case out loud. Suppose the sidebar is opened for a pending transaction, and then when that transaction goes from Now, what if we open the sidebar for a retry for a failed transaction while there is another transaction pending, and then while the sidebar is open the pending transaction is confirmed. Then I guess the transaction-list-item needs to know the id of the transaction in the sidebar and decide whether to dispatch the action based on if the id matches the transaction going from Yeah I guess that will be okay too. The only gotcha could be that there are two different lists of transactions ( In terms of number of code changes, I think my alternative solution proposed in my earlier comment will be simplest, but I think what you've suggested might be cleanest and most intuitive (because the |
Okay, this should be good now /cc @danjm |
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.
Looks good now! Nice work
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.
LGTM, let's be sure to use the "Squash and merge" option here on GitHub
@@ -206,6 +206,10 @@ class Routes extends Component { | |||
} | |||
: null | |||
|
|||
const sidebarShouldClose = sidebarTransaction && | |||
!sidebarTransaction.status === 'failed' && |
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.
I suspect that this would result in the sidebar staying open if it went from pending
to failed
, which seems... bad. 🤔
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.
We could move sidebarShouldClose
into component state (along with the status), then compare in getDerivedStateFromProps
the current status to the previous status to determine whether such a transition occurred, or whether it was failed
from the start.
Or even better, we could move it into Redux. We could respond to UPDATE_METAMASK_STATE
in the appState
store. If the sidebar is open, and if the sidebar transaction has just transitioned from a pending state, then we could set the sidebar to closed directly.
In general I think we should be responding to background state changes in Redux, not in the UI. Either in the reducers or the actions. In this case, responding in the reducer seems to make the most sense.
(Well technically if we were to do this in an action, it'd be less "responding" and more "coordinating changes")
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.
should we revert then? I was looking at this and thinking the same thing re: "Or even better, we could move it into Redux. We could respond to UPDATE_METAMASK_STATE in the appState store"...
If this is going to cause issues in rc we should not ?
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... given that the impact of this regression is minor, I think it'd be fine to leave it if we think we can fix it within the week (before the RC is released). Then we can revert as a fallback, if that timeline doesn't work out.
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.
yeah, I don't think a revert is necessary. This will happen very very rarely, but should still be fixed.
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.
okay we can spend some time this week looking at this
re: #7193
saw the
this.handleRetry
functionality and just reused that? not sure if this is actually what we want mind you. also do we want this to only be available for failed transactions? or does it make sense for it to be displayed onpending
as well?