Studio: Show all WordPress.com sites when importing, not just unconnected ones - #2235
Conversation
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>
📊 Performance Test ResultsComparing 024adfc vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
There was a problem hiding this comment.
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.
|
Thanks @sejas and @katinthehatsite for your reviews 🙇 !
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 |


Related issues
Proposed Changes
connectedSiteIdsparameter optional in theuseGetWpComSitesQueryAPI to avoid filtering themtransformSitesResponsefunction to handle optionalconnectedSiteIdsusing optional chainingconnectedSiteIdsparameter to theuseGetWpComSitesQueryin the PullRemoteSite componentTesting Instructions
npm startConnect another siteAlready connectedlabelPre-merge Checklist