-
Notifications
You must be signed in to change notification settings - Fork 2k
A4A: Add loading indicator when removing site. #103284
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
base: trunk
Are you sure you want to change the base?
Conversation
…nting issue with component display name.
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
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.
Pull Request Overview
This PR improves the user experience when removing a site by adding a loading indicator and refactoring the modal component for better readability. Key changes include:
- Introducing the isPending state to manage the busy indicator on the remove site button.
- Refactoring the component structure to separate type definitions and the main component.
- Ensuring the busy state is updated via both the onSuccess and onSettled callbacks.
setIsPending( false ); | ||
} ); | ||
}, 1000 ); | ||
}, | ||
onSettled: () => { | ||
setIsPending( false ); |
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.
The isPending state is set to false in both the onSuccess callback (inside the setTimeout) and the onSettled callback; consider centralizing state cleanup to avoid redundancy.
setIsPending( false ); | |
} ); | |
}, 1000 ); | |
}, | |
onSettled: () => { | |
setIsPending( false ); | |
} ); | |
}, 1000 ); | |
}, | |
onSettled: () => { | |
// Ensure state cleanup after the delay. | |
setTimeout( () => { | |
setIsPending( false ); | |
}, 1000 ); |
Copilot uses AI. Check for mistakes.
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 can't do this because a refetch adds another delay on top of the 1 second.
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~102 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
The current 'Remove site' experience is somewhat broken, lacking any indication that the dashboard is processing the request. This PR introduces an
isBusy
state on the button to show that the site is loading.Screen.Recording.2025-05-09.at.7.24.59.PM.mov
Closes https://linear.app/a8c/issue/A4A-793/show-a-loading-indicator-when-the-remove-site-request-is-in-progress
Proposed Changes
isPending
state to the button to display the busy indicator. The isPending state should not depend on the mutation state; instead, it uses a custom state due to a one-second delay for refetching sites after a site has been removed.Why are these changes being made?
Testing Instructions
/sites
.Pre-merge Checklist