-
Notifications
You must be signed in to change notification settings - Fork 50
Implement RTK Query approach for fetching wpcom sites #2132
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
base: trunk
Are you sure you want to change the base?
Implement RTK Query approach for fetching wpcom sites #2132
Conversation
📊 Performance Test ResultsComparing 21ec897 vs trunk site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change |
sejas
left a comment
There was a problem hiding this 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
src/modules/sync/index.tsx
Outdated
| dispatch( connectedSitesActions.openModal( pendingModalMode ) ); | ||
| setPendingModalMode( null ); | ||
| if ( isModalOpen && isAuthenticated && ! isUninitializedSyncSites ) { | ||
| refetchWpComSites().catch( ( error ) => { |
There was a problem hiding this comment.
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?
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
useFetchWpComSiteshook to RTK Query withuseGetWpComSitesQuery. The new query uses the userId to invalidate the cachesrc/hooks/use-fetch-wpcom-sites/tosrc/modules/sync/lib/src/modules/sync/types.tssync-support.tsmodule forgetSyncSupportand helper functionsStreamline Onboardingfeature flagTesting Instructions
npm startPublish sitebutton and observe that the loading experience is fine (there are no multiple loading indicators)Publish siteand check that the loading is minimal as the sites are cachedPull sitebuttonPublish sitebutton, check that the deleted or created site is displayed (there could be a delay)Publish sitebuttonFind a perfect planmodal is displayedPre-merge Checklist