Skip to content
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: handle user cancel in transaction modal #1234

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Mar 4, 2025

Summary

Closes: #1181

This PR handle the transaction cancel action more gracefully by not showing an error, and just close the modal.

Also remove the transaction modal when saving offchain space settings, and handle the save directly, like for voting.

How to test

  1. Go to an offchain space setting, and save it
  2. It should save without the transaction modal
  3. Trigger an onchain tx/signature (vote, delegation, space saving)
  4. Cancel the action on the wallet
  5. It should close the transaction modal

@wa0x6e wa0x6e changed the title fix: skip transaction modal for offchain space saving fix: handle user cancel in transaction modal Mar 4, 2025
@wa0x6e wa0x6e requested a review from ChaituVR March 4, 2025 00:51
@wa0x6e wa0x6e marked this pull request as ready for review March 4, 2025 00:51
@bonustrack
Copy link
Member

We should keep the modals like this one, just not trigger "Transaction failed" modal when user cancel signing message or a tx on his wallet:
image

What happened with the vote modal where we can share a vote? I can't see it on this PR or production.

Also when I click save to change space settings and click Cancel on Metamask, the Save button endup in infinite loading.
image

@wa0x6e
Copy link
Contributor Author

wa0x6e commented Mar 4, 2025

We should keep the modals like this one, just not trigger "Transaction failed" modal when user cancel signing message or a tx on his wallet: image

What happened with the vote modal where we can share a vote? I can't see it on this PR or production.

Also when I click save to change space settings and click Cancel on Metamask, the Save button endup in infinite loading. image

  • Fix the issue where share vote modal is not showing
  • Fix the issue where cancelling offchain space setting saving is not resetting button loading state
  • Cancelling the wallet action will now keep the modal open, with the cancellation error

localhost_8080_

@wa0x6e wa0x6e requested review from bonustrack and Copilot March 4, 2025 12:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR improves user experience by handling transaction cancellation gracefully and streamlining the offchain space settings flow. Key changes include:

  • Rethrowing original errors in network verification instead of wrapping them.
  • Adjusting the settings save flow to bypass the transaction modal for offchain space settings.
  • Adding a new "reject" UI state in the transaction modal to visually differentiate cancelled transactions.

Reviewed Changes

File Description
apps/ui/src/helpers/utils.ts Changes error handling in network verification by rethrowing errors directly.
apps/ui/src/views/Space/Settings.vue Modifies the save function to handle offchain saves without displaying the transaction modal.
apps/ui/src/components/Modal/TransactionProgress.vue Introduces a new "reject" step with dedicated UI elements and messages for cancelled transactions.

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

apps/ui/src/components/Modal/TransactionProgress.vue:73

  • [nitpick] The default rejection subtitle 'You need to confirm the transaction to proceed' might be confusing if the transaction was cancelled intentionally. Consider updating it to clearly indicate that the transaction was cancelled by the user.
  if (step.value === 'reject') {

apps/ui/src/components/Modal/TransactionProgress.vue:102

  • Consider adding a comment or logging for the rejection case so that rejections can be better traced during debugging, even though they are handled by setting the 'reject' step.
    if (['ACTION_REJECTED', 4001].includes(e.code)) {

Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tAck

@bonustrack
Copy link
Member

I can't see the vote share modal when I cast a vote. When I cancel a tx on SX I see "Transaction failed" and not "Transaction cancelled" modal. I don't think anyway we need a "Transaction cancelled" modal, instead we should show the vote modal or his previous steps if another action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ux: don't show Transaction failed error if rejected
3 participants