Skip to content

Conversation

@epeicher
Copy link
Contributor

@epeicher epeicher commented Nov 25, 2025

Related issues

Before

CleanShot.2025-11-26.at.20.17.26-trimmed.mp4

After

CleanShot.2025-11-26.at.20.18.33.mp4

Proposed Changes

  • Migrated from custom useFetchWpComSites hook to RTK Query with useGetWpComSitesQuery. The new query uses the userId to invalidate the cache
  • Improved state management with automatic caching, background refetching, and request deduplication
  • Reorganized sync utilities:
    • Moved sync-related utilities from src/hooks/use-fetch-wpcom-sites/ to src/modules/sync/lib/
    • Consolidated types into src/modules/sync/types.ts
    • Created shared sync-support.ts module for getSyncSupport and helper functions
  • Updated all imports across 20+ files to reflect new structure
  • Removed deprecated hook directory
  • Enables by default the Streamline Onboarding feature flag

Testing Instructions

  • Apply this branch and run npm start
  • Use or create a site that does not have any connected sites
  • Click on Publish site button and observe that the loading experience is fine (there are no multiple loading indicators)
  • On the Sync tab, click on Publish site and check that the loading is minimal as the sites are cached
  • Test also the Pull site button
  • Delete or create a new site on WordPress.com
  • Click on the Publish site button, check that the deleted or created site is displayed (there could be a delay)
  • Log out and log in with a user with no sites
  • Click on the Publish site button
  • Check that the Find a perfect plan modal is displayed
  • Check different use cases and confirm that the sites are correctly loaded

Pre-merge Checklist

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

@epeicher epeicher marked this pull request as ready for review November 26, 2025 19:53
@github-actions
Copy link
Contributor

github-actions bot commented Nov 26, 2025

📊 Performance Test Results

Comparing 21ec897 vs trunk

site-editor

Metric trunk 21ec897 Diff Change
load 13313.00 ms 9449.00 ms -3864.00 ms 🟢 -29.0%

site-startup

Metric trunk 21ec897 Diff Change
siteCreation 28598.00 ms 24404.00 ms -4194.00 ms 🟢 -14.7%
siteStartup 9006.00 ms 8061.00 ms -945.00 ms 🟢 -10.5%

Results are median values from multiple test runs.

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

Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

Great work! Thanks for moving the wpcom sites request to RTK. Now it doesn't block the user every time we click on the buttons.
I just noticed that we display a loading state in the push site button every time we change tabs.

loading-push-site-button.mp4

dispatch( connectedSitesActions.openModal( pendingModalMode ) );
setPendingModalMode( null );
if ( isModalOpen && isAuthenticated && ! isUninitializedSyncSites ) {
refetchWpComSites().catch( ( error ) => {
Copy link
Member

Choose a reason for hiding this comment

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

Would be possible to refetch wpcom sites inside openModal action or call it at the same time?

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.

3 participants