Staging sites: Add Delete staging site
button to the Staging Site
tab (when managing staging site)
#98416
+70
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves https://github.com/Automattic/dotcom-forge/issues/9974.
Proposed Changes
In this draft PR I am proposing a solution that adds
Delete staging site
button to theStaging site
tab when we are managing that specific staging site:ℹ️ Please ignore the styling for the moment. That's something I am planning to work on later.
The proposed solution works as follows:
Delete staging site
button with confirmation modal.deleteStagingSite
).Staging Site
tab on the Production site. This is required as the staging site is being deleted.There's still one issue that I haven't been able to figure out yet: Even the staging site revert / deletion process finishes, the UI does not update for the user. Here's a screen recording to better illustrate:
Screen.Capture.on.2025-01-15.at.15-07-26.mp4
Instead, the
Add staging site
button should get rendered automatically as soon as the staging site is deleted:When investigating this issue, it turns out that the
/sites/${ siteId }/staging-site
endpoint (queried inclient/sites/tools/staging-site/hooks/use-staging-site.ts
) does not get re-triggered and hence the app still thinks the staging site exists.So far we tried to solve the issue by manually invalidating the
USE_STAGING_SITE_QUERY_KEY
query (as can be seen in the PR), but that doesn't seem to work reliably.I would appreciate any feedback / thoughts on the proposed changes and what do you think about the query issue. I am happy to jump on a call if that helps.
Why are these changes being made?
Testing Instructions
Staging Site
tab of the staging site and try to delete the staging site.Pre-merge Checklist