-
Notifications
You must be signed in to change notification settings - Fork 408
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
fix: improve disable condition and tooltip tile on TxSummary
buttons
#1969
Conversation
Branch preview✅ Deploy successful! https://fix_disable_execute_button--walletweb.review-wallet-web.5afe.dev |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
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've added some comments to the ExecuteTxButton
but they stand for each. I'd suggest consulting with design about this.
A simpler solution would be disabling the submit button in the transaction SignOrExecute
modal when the SDK is initialising.
@@ -26,9 +27,19 @@ const ExecuteTxButton = ({ | |||
const txNonce = isMultisigExecutionInfo(txSummary.executionInfo) ? txSummary.executionInfo.nonce : undefined | |||
const isPending = useIsPending(txSummary.id) | |||
const { setSelectedTxId } = useContext(ReplaceTxHoverContext) | |||
const safeSDK = getSafeSDK() |
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.
getSafeSDK
will not react to changes in ExternalStore
state. We should use the hook when accessing the value.
|
||
const tooltipTitle = | ||
isDisabled && !isNext | ||
? `Transaction ${safe.nonce} must be executed first` |
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 don't think we need to show this, maybe even the button at all.
isDisabled && !isNext | ||
? `Transaction ${safe.nonce} must be executed first` | ||
: isPending | ||
? `There's a pending transaction` |
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 would be more descriptive here, e.g.
? `There's a pending transaction` | |
? `You cannot execute while a transaction is pending.` |
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 was trying to juggle between a more complete description and a more succinct one given it's a tooltip. Said that are you still in favor of the longer one?
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.
Compared to the title
on line 37, I think it needs more information. An alternative: "Pending transaction must first succeed".
: isPending | ||
? `There's a pending transaction` | ||
: !safeSDK | ||
? 'Waiting for the SDK to initialize' |
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'm not sure about this - it's somewhat technical for the "standard" user. It shouldn't happen to too long 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.
That is already too late, the error appears when loading the values in that modal. That's why I think we should prevent opening it. |
Could you suppress the error until the SDK has initialised/failed to initialise? |
The way we render safe-wallet-web/src/components/tx/modals/ConfirmTxModal/ConfirmProposedTx.tsx Lines 32 to 46 in 3bc22a0
|
const enabledTitle = 'Execute' | ||
|
||
expect(getTxButtonTooltip(enabledTitle, disabledPropsBase)).toBe('Execute') | ||
expect(true).toBe(true) |
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.
expect(true).toBe(true) |
const disabledProps = { ...disabledPropsBase, isPending: true } | ||
|
||
expect(getTxButtonTooltip(enabledTitle, disabledProps)).toBe('Pending transaction must first succeed') | ||
expect(true).toBe(true) |
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.
expect(true).toBe(true) |
const disabledProps = { ...disabledPropsBase, hasSafeSDK: false } | ||
|
||
expect(getTxButtonTooltip(enabledTitle, disabledProps)).toBe('Waiting for the SDK to initialize') | ||
expect(true).toBe(true) |
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.
expect(true).toBe(true) |
Issue: |
@usame-algan @francovenica What do you think of changing that tooltip to "Transaction in execution" ? dropping the "must execute first" that can be misleading. |
Can we please wrap this up? The amount of discussion and attention this fix receives starts to worry me. |
I think not showing the tooltip in a executing tx is fine. The tx is supposed to disappear anyways after execution |
These tooltips ("Execute", "Replace", "Confirm") were already in place and were not affected by this bug fix/improvement. |
Yes, I think we are done with this ticket. I'll pass it |
What it solves
Resolves #1932
How this PR fixes it
Includes the
coreSDK
initialization in the condition to disable the<TxSummary>
buttons (ExecuteTxButton
,RejectTxButton
andSignTxbutton
)Improve tooltip description as per the disable condition
How to test it
Not next tx
Transaction is pending execution1. Go to a Tx queue and have 2 transactions ready to be executed2. Execute the first one
3. Observe the execution icons in the second one is disabled and show a tooltip "Pending transaction must first succeed"
Safe SDK not initialized
Screenshots
Checklist