-
Notifications
You must be signed in to change notification settings - Fork 54
Preview Sites: Delete all preview sites using /delete/all API endpoint
#1950
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
📊 Performance Test ResultsComparing 040a48c vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
15c97d2 to
02173f7
Compare
/delete/all API endpoint
/delete/all API endpoint/delete/all API endpoint
|
I was wondering if it will be clear to the user that it removes all preview sites on the account, and not only those created from the given Studio instance, but it seems that the dialog already makes it clear:
|
| }; | ||
| } | ||
|
|
||
| export function withOfflineCheckMutation< TResult, TArg, TBaseQuery extends BaseQueryFn >( |
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.
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’s a great point. I agree it’s not needed right now, but I added it just in case we need the offline check elsewhere while using another API. No strong opinion here, though I would slightly prefer keeping it since withOfflineCheckMutation could be useful later.
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 keep it then 👍 If it is not something that we use often, we can clean this up later.
This is what I thought as well. That's why I didn't alter the message. |
02173f7 to
1c10b07
Compare
ivan-ottinger
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.
@ivan-ottinger, Great question. This is the intended behavior for cases where two separate instances of Studio are out of sync. While disabling the button might seem reasonable, there are several scenarios where keeping it enabled is actually helpful. |
I see. Are you referring to a case where the |
This is the goal, with the new implementation, the button should always be available to let the user clean preview sites from their account. |
Makes sense. 👍🏼 |
I am finding this a bit of a strange UI but I guess there are not many ways around it. |
katinthehatsite
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.
👍
Yeah. likewise. I thought about it yesterday and maybe I am missing something, but: Cannot we do the following?
The
The |
Since we are already querying usage on the component. I think it makes sense to do a quick check on the user's account. I will update the code to disable the button when there are no preview sites on the user's account. cc @wojtekn The remaining suggested behaviours have already been implemented in #1950. |
|
@ivan-ottinger Thanks for the feedback so far. I have addressed your concerns in e45a445. Could you review it again? |
Nice! Thank you for the updates. The changes look good and I can see that if there are no remote preview sites, the button gets disabled:
|





Related issues
Proposed Changes
Testing Instructions
Apply the patch 194679-ghe-Automattic/wpcom on your sandbox.
Run Studio using this branch.
Start the application with:
Open Developer Tools and keep the Network tab open.
Navigate to the Preferences tab in Studio and log in (if not already).
Go to the Usage tab and click Delete all preview sites.
Verify that a request to
was sent and returned a successful response
Confirm that the usage numbers are reset.
Close and reopen the Usage tab.
Ensure the updated usage numbers are still reflected.
Open the following file on your system:
Verify that the snapshots array is cleared and shows as
[].Pre-merge Checklist