Skip to content

Experiment to speed up deeplink connection from WP.com#2375

Open
katinthehatsite wants to merge 19 commits intotrunkfrom
add/speed-up-connection-time
Open

Experiment to speed up deeplink connection from WP.com#2375
katinthehatsite wants to merge 19 commits intotrunkfrom
add/speed-up-connection-time

Conversation

@katinthehatsite
Copy link
Contributor

@katinthehatsite katinthehatsite commented Jan 9, 2026

Related issues

Related to STU-1173

Proposed Changes

This PR explores the speeding up of the deeplink connection from WP.com e.g. connecting a WP.com site and opening a modal.

  • immediately create a minimal site object with data from the deeplink (this would need to be done on WP.com side, but we can add WP.com site's URL and site name which would be enough for our UI)
  • display the loading skeleton while we are connecting
  • fetch the remote site right away
  • and trigger the API refetch in parallel without blocking

Testing Instructions

  • Pull the changes from this branch
  • Start Studio
  • Navigate to the Sync tab
  • Make sure that you don't have any WP.com sites connected to your Studio site so that the Publish site button displays in the top right corner
  • Click on the Publish site button
  • Observe that you are brought to WP.com
  • Complete the purchase
  • Wait for the site to go Atomic
  • Observe that you see a popup asking you to open Studio
  • Confirm that you can see the loading skeleton on the Sync tab
  • Confirm that the site you just created is connected in the Sync tab
  • Confirm that the Push modal is open
  • Confirm that there are no other regressions

Pre-merge Checklist

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

@katinthehatsite katinthehatsite self-assigned this Jan 9, 2026
@katinthehatsite katinthehatsite marked this pull request as draft January 9, 2026 13:07
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 9, 2026

📊 Performance Test Results

Comparing 4f649f5 vs trunk

site-editor

Metric trunk 4f649f5 Diff Change
load 1767.00 ms 1486.00 ms -281.00 ms 🟢 -15.9%

site-startup

Metric trunk 4f649f5 Diff Change
siteCreation 6079.00 ms 6143.00 ms +64.00 ms 🔴 1.1%
siteStartup 3944.00 ms 3939.00 ms -5.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@katinthehatsite
Copy link
Contributor Author

The code needs to be polished quite a bit so I am leaving this PR as a draft. What I am looking for is the feedback on the approach before adding any further polishing touches - does it make sense? is there a different way we could optimize the speed of connection that could be simpler?

One thing I dislike is creating a "fictional" site object that could potentially cause racing conditions and similar issues. Any opinions are welcome!

One option as an alternative that comes to mind could be adding a loading state to Sync tab if the user is connecting a site from deeplink and it is taking time. This way, they could have a visual indication of what is happening and this could be a simple and fast improvement in terms of the UX.

@katinthehatsite katinthehatsite requested a review from a team February 4, 2026 13:03
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.

Thanks for exploring how to speed up the deeplink connection.
In general the approach makes sense to me. Loading an optimistic connection until we fetch more information.
My concern is if we display wrong data, like isStaging, or isPressable. With the current flow where the user purchase a new site, those will always be false, but in the future we could add more deeplinks in Calypso.
What if we show a loading skeleton until we fetch the information?
As mentioned below, we can optimize the fetch call to get only the information for that specific site.

}

// Fetch full site data in background (don't await - parallel operation)
const refetchPromise = refetchWpComSites();
Copy link
Member

Choose a reason for hiding this comment

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

Another optimization could be fetching only the information of the remoteSiteId. Currently fetching all the sites takes longer, specially for Automatticians.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found an endpoint that allowed to fetch just one site instead of all sites so I went with that solution.

const minimalSite: SyncSite = {
id: remoteSiteId,
localSiteId: studioSiteId,
name: siteName || 'Loading site...', // Use provided name or placeholder
Copy link
Member

Choose a reason for hiding this comment

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

We need to translate the placeholder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it was not needed at the end after I added the loading placeholder so I removed it.

@katinthehatsite
Copy link
Contributor Author

Thank you for review @sejas - I will take a look at the next steps today 👀

@katinthehatsite
Copy link
Contributor Author

@sejas I made some adjustments on this branch based on your recommendations. Would you be able to give it another look?

@katinthehatsite katinthehatsite marked this pull request as ready for review February 20, 2026 12:48
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.

@katinthehatsite , great work. Thanks for addressing my suggestions.
I tested it and it works much better with the loading skeleton. Thanks for improving this flow.
I left a couple of comments. Let me know what you think. I also noticed that the loading skeleton is visible even after the single site request resolves, so it seems in the end it uses the whole sites request to decide if should be loading or not. Or at least that was my impression.
I also noticed we try to use the siteurl and site title, but that information is not passed from the deep link. I think it's ok to remove those because the skeleton gives enough context IMO.

Firs time connection:

first-time-connection.mp4

Second time connection:

I also tested it by disconnecting and repeating the deep link.

second-time.mp4

@katinthehatsite
Copy link
Contributor Author

katinthehatsite commented Feb 24, 2026

I also noticed that the loading skeleton is visible even after the single site request resolves, so it seems in the end it uses the whole sites request to decide if should be loading or not. Or at least that was my impression.

I saw this as well before but thought it was resolved. Taking a look now 👀

Update: I see it on the reconnection but not on the initial connection 🤔

@katinthehatsite
Copy link
Contributor Author

I made some more adjustments - let me know what you think!

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.

@katinthehatsite , thanks for applying the suggestions.
I found a bug where Studio opens the list of sites to connect if the user has selected another site.
Steps to reproduce:

  1. Click publish site for site1, and continue the flow
  2. Got to studio and switch to site 2
  3. Go to the browser and click open in studio which should open the modal for site1
  4. Observe that the site correctly connects in the sync tab and the modal that opens shows the list of sites
  5. I would expect the modal that opens is the selective sync

It works as expected if I don't switch sites before clicking open in studio.

publish-site-fast-deep-link-bug-different-local-site.mp4

Kateryna Kodonenko added 3 commits March 6, 2026 14:07
Resolved conflicts in sync-connected-sites.tsx and sync/index.tsx by
adopting trunk's Redux selector pattern (syncOperationsSelectors/Thunks/Actions
replacing the old useSyncSites hook) while preserving the PR's
isLoadingConnectedSites and isSiteLoading skeleton UI improvements.

Made-with: Cursor
@katinthehatsite
Copy link
Contributor Author

Click publish site for site1, and continue the flow
Got to studio and switch to site 2
Go to the browser and click open in studio which should open the modal for site1
Observe that the site correctly connects in the sync tab and the modal that opens shows the list of sites
I would expect the modal that opens is the selective sync
It works as expected if I don't switch sites before clicking open in studio.

Thank you for testing @sejas - I made some further adjustments as well as rebased trunk. Would you be able to give it another test?

@katinthehatsite katinthehatsite requested a review from sejas March 6, 2026 14:24
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