Skip to content

Studio: Show all WordPress.com sites when importing, not just unconnected ones - #2235

Merged
epeicher merged 4 commits into
trunkfrom
stu-1123-studio-connected-sites-to-the-selected-site-are-not
Dec 11, 2025
Merged

Studio: Show all WordPress.com sites when importing, not just unconnected ones#2235
epeicher merged 4 commits into
trunkfrom
stu-1123-studio-connected-sites-to-the-selected-site-are-not

Conversation

@epeicher

@epeicher epeicher commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

  • Made connectedSiteIds parameter optional in the useGetWpComSitesQuery API to avoid filtering them
  • Updated the transformSitesResponse function to handle optional connectedSiteIds using optional chaining
  • Do not pass connectedSiteIds parameter to the useGetWpComSitesQuery in the PullRemoteSite component

Testing Instructions

  1. Apply this branch and run npm start
  2. Ensure you have at least one local site already connected to a WordPress.com site
  3. Click "Add Site" and select "Pull an existing site"
  4. Verify that ALL your WordPress.com sites are displayed in the list, including those already connected to other local sites
  5. Confirm you can select and import any site from the list, even if it's already connected elsewhere
  6. Navigate to the Sync tab on a site with a connected site
  7. Click on Connect another site
  8. Verify that the connected site appears in the list greyed out with the Already connected label

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@epeicher epeicher self-assigned this Dec 10, 2025
epeicher and others added 2 commits December 10, 2025 18:06
Makes the connectedSiteIds parameter optional in useGetWpComSitesQuery
for a more robust approach. When not provided, no filtering based on
connected sites is applied, allowing all available sites to be fetched.

This improves the API design by making the filtering behavior explicit
and removes the need to pass empty arrays when filtering is not needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Updates the deleted sites filter to maintain backward compatibility with
trunk while supporting optional connectedSiteIds parameter.

Behavior:
- Deleted sites are always filtered out
- Exception: deleted sites in connectedSiteIds list are kept
- When connectedSiteIds is undefined, no deleted sites are shown

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@epeicher
epeicher requested a review from a team December 10, 2025 17:23
@epeicher
epeicher marked this pull request as ready for review December 10, 2025 17:23
@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Test Results

Comparing 024adfc vs trunk

site-editor

Metric trunk 024adfc Diff Change
load 11936.00 ms 12068.00 ms +132.00 ms 🔴 1.1%

site-startup

Metric trunk 024adfc Diff Change
siteCreation 27643.00 ms 21410.00 ms -6233.00 ms 🟢 -22.5%
siteStartup 9010.00 ms 8986.00 ms -24.00 ms 🟢 -0.3%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for fixing the issue. I confirm that now the list of sites don't exclude the already connected sites when creating a new site, and it correctly appears when connecting a site.

I wonder if it would be possible to reuse the same request fingerprint to take advantage of the cached state. Currently, the list of sites in the Add Site modal takes longer to appear because it doesn't use the cached data from the other modal. I noticed that we accidentally removed the loading state in a different PR, which makes the issue more visible.

Image Image
@katinthehatsite

katinthehatsite commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

This worked well for me:

Screenshot 2025-12-10 at 8 23 52 PM Screenshot 2025-12-10 at 8 23 01 PM

I wonder if it would be possible to reuse the same request fingerprint to take advantage of the cached state. Currently, the list of sites in the Add Site modal takes longer to appear because it doesn't use the cached data from the other modal. I noticed that we accidentally removed the loading state in a different PR, which makes the issue more visible.

I also noticed the same issue. I think we should definitely solve for this but it does not have to be in this PR.

I also suspect that it might have been me who removed it 🙈

@epeicher

Copy link
Copy Markdown
Contributor Author

Thanks @sejas and @katinthehatsite for your reviews 🙇 !

I wonder if it would be possible to reuse the same request fingerprint to take advantage of the cached state. Currently, the list of sites in the Add Site modal takes longer to appear because it doesn't use the cached data from the other modal. I noticed that we accidentally removed the loading state in a different PR, which makes the issue more visible.

I am going to create a follow-up to recover the loading state. I think the list of sites is cached already. I will investigate further in the follow-up

@epeicher
epeicher merged commit 42017ab into trunk Dec 11, 2025
10 checks passed
@epeicher
epeicher deleted the stu-1123-studio-connected-sites-to-the-selected-site-are-not branch December 11, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants