-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: Show pending revocation on click #38184
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
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/core-extension-ux (2 files, +98 -31)
|
Builds ready [33ffe79]
UI Startup Metrics (1239 ± 121 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
jeffsmale90
left a comment
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 - I'm not sure why we need the timeout complexity, but if it's definitely necessary then I'm happy with it as is 🎉🐊
ui/components/multichain/pages/gator-permissions/components/review-gator-permission-item.tsx
Outdated
Show resolved
Hide resolved
...ents/multichain/pages/gator-permissions/review-permissions/review-gator-permissions-page.tsx
Outdated
Show resolved
Hide resolved
Its because of delays in the UI, the transaction window takes up so much time to load that the return statements gets processed the button flicks back to Revoke then the transaction window opens. It causes like a quick flick which is noticeable. So with the delay we make sure it does not happen. |
Builds ready [a6c5876]
UI Startup Metrics (1315 ± 120 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
jeffsmale90
left a comment
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.
Let's go!
Builds ready [f675d88]
UI Startup Metrics (1259 ± 109 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
## **Description** This PR improves the user experience when revoking Gator permissions by adding optimistic UI feedback. **What is the reason for the change?** When users clicked the "Revoke" button for a Gator permission, there was a noticeable delay before the button appeared disabled and showed "Pending..." text. This created a poor user experience where users might click multiple times, unsure if their action was registered. **What is the improvement/solution?** The solution implements optimistic UI feedback by: 1. Immediately setting a pending state when the revoke button is clicked 2. Disabling the button and displaying "Pending..." text right away 3. Managing the pending state with a 800ms timeout after the revoke operation completes to prevent visual flashing before the transaction confirmation window appears 4. Properly cleaning up timeouts on component unmount to prevent memory leaks 5. Immediately clearing the pending state if an error occurs The implementation uses local component state (`pendingRevokeClicks`) combined with the existing global pending revocations selector to provide a smooth, responsive user experience. [](https://codespaces.new/MetaMask/metamask-extension/pull/38184?quickstart=1) ## **Changelog** CHANGELOG entry: Improved responsiveness of revoke button in Gator permissions by adding immediate UI feedback ## **Manual testing steps** 1. Go to all permissions 2. Find a permission 3. Click revoke -> the button should turn to pending revocation right away, before the revoke transaction window shows. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> https://github.com/user-attachments/assets/7e111d41-3857-44a0-84ea-7569af0f9e01 ### **After** https://github.com/user-attachments/assets/5c222555-8f0d-4dc5-b70e-247350024cdd <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds optimistic pending state for Gator permission revocations, disabling the button and showing "Pending..." immediately with timeout cleanup. > > - **UI — Gator Permissions** > - `review-permissions/review-gator-permissions-page.tsx`: > - Introduces local pending state via `pendingRevokeClicks` (Set) and `revokeTimeoutsRef` (Map) with unmount cleanup. > - Updates `handleRevokeClick` to optimistically set pending, call `revokeGatorPermission`, then clear after 800ms; clears immediately on error. > - Passes `hasRevokeBeenClicked` to children; simplifies empty-state check to `gatorPermissions.length`. > - `components/review-gator-permission-item.tsx`: > - Adds optional `hasRevokeBeenClicked` prop and integrates it into `isPendingRevocation` alongside global `pendingRevocations`. > - Disables Revoke button and switches label to pending when either local or global pending is true. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f675d88. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Description
This PR improves the user experience when revoking Gator permissions by adding optimistic UI feedback.
What is the reason for the change?
When users clicked the "Revoke" button for a Gator permission, there was a noticeable delay before the button appeared disabled and showed "Pending..." text. This created a poor user experience where users might click multiple times, unsure if their action was registered.
What is the improvement/solution?
The solution implements optimistic UI feedback by:
The implementation uses local component state (
pendingRevokeClicks) combined with the existing global pending revocations selector to provide a smooth, responsive user experience.Changelog
CHANGELOG entry: Improved responsiveness of revoke button in Gator permissions by adding immediate UI feedback
Manual testing steps
Screenshots/Recordings
Before
Screen.Recording.2025-11-24.at.14.21.47.mov
After
Screen.Recording.2025-11-24.at.14.20.37.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds optimistic pending state for Gator permission revocations, disabling the button and showing "Pending..." immediately with timeout cleanup.
review-permissions/review-gator-permissions-page.tsx:pendingRevokeClicks(Set) andrevokeTimeoutsRef(Map) with unmount cleanup.handleRevokeClickto optimistically set pending, callrevokeGatorPermission, then clear after 800ms; clears immediately on error.hasRevokeBeenClickedto children; simplifies empty-state check togatorPermissions.length.components/review-gator-permission-item.tsx:hasRevokeBeenClickedprop and integrates it intoisPendingRevocationalongside globalpendingRevocations.Written by Cursor Bugbot for commit f675d88. This will update automatically on new commits. Configure here.