Skip to content
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

Ensure that staging sites display a Staging sticker from the moment they are created #897

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

fredrikekelund
Copy link
Contributor

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 the is_wpcom_staging_site prop until the site setup is completed. The problem was also made worse by the reconcileConnectedSites function not refreshing the value for isStaging.

This PR changes the logic in transformSitesResponse so we look at the wpcom_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 updated reconcileConnectedSites to refresh the isStaging value.

Testing Instructions

  1. Log in to WordPress.com in Studio
  2. Connect a Studio site to a WordPress.com site
  3. If the site already has a staging site, delete it
  4. Go to wordpress.com/sites and create a new staging site for the site in question
  5. Open Studio again and periodically switch between the Share and Sync tabs (this triggers a new fetch from the /sites API endpoint)
  6. Ensure that when the staging site appears in the Sync tab, the sticker to the left says Staging (see screenshot below for clarification)
Screenshot 2025-02-05 at 15 49 06

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Sorry, something went wrong.

@fredrikekelund fredrikekelund requested a review from a team February 5, 2025 14:49
@fredrikekelund fredrikekelund self-assigned this Feb 5, 2025
Copy link
Contributor

@nightnei nightnei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and works well - confirms that even if site was marked as Production in Trunk, then after switching to this branch it's fixed ("stage" badge is rendered)

@fredrikekelund fredrikekelund merged commit 01e5ce2 into trunk Feb 10, 2025
7 checks passed
@fredrikekelund fredrikekelund deleted the f26d/tweak-reconcile-connected-sites branch February 10, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants