Ensure that staging sites display a Staging
sticker from the moment they are created
#897
+41
−35
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.
Related issues
Proposed Changes
As reported in https://github.com/Automattic/dotcom-forge/issues/10308, newly created staging sites display a
Production
sticker in the Sync tab. This happens because the/sites
API endpoint returns the wrong value for theis_wpcom_staging_site
prop until the site setup is completed. The problem was also made worse by thereconcileConnectedSites
function not refreshing the value forisStaging
.This PR changes the logic in
transformSitesResponse
so we look at thewpcom_staging_blog_ids
arrays of other sites to determine if the given site is a staging site. This data appears to be stable from the moment a new staging site is created. For good measure, I've also updatedreconcileConnectedSites
to refresh theisStaging
value.Testing Instructions
wordpress.com/sites
and create a new staging site for the site in questionShare
andSync
tabs (this triggers a new fetch from the/sites
API endpoint)Staging
(see screenshot below for clarification)Pre-merge Checklist