Conversation
Replace all usages with the existing updateConnectedWpcomSites handler by wrapping the single site in an array. This eliminates a redundant IPC handler that duplicated logic already present in the bulk variant.
📊 Performance Test ResultsComparing e176572 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
The updateSiteTimestamp calls were dropped in #2037 when push/pull states moved from SyncSitesProvider to a Redux slice. Wire them back up by dispatching the RTK Query mutation from the thunks.
…oving-updatesingleconnectedwpcomsite-ipc-handler
…oving-updatesingleconnectedwpcomsite-ipc-handler
| void dispatch( | ||
| connectedSitesApi.endpoints.updateSiteTimestamp.initiate( { | ||
| siteId: remoteSiteId, | ||
| localSiteId: selectedSiteId, | ||
| type: 'push', | ||
| } ) | ||
| ); |
There was a problem hiding this comment.
useUpdateSiteTimestampMutation doesn't appear to be used anywhere. I think it'd be better to call getIpcApi().updateConnectedWpcomSites directly here and remove the updateSiteTimestamp mutation altogether.
There was a problem hiding this comment.
Good catch! Removed the updateSiteTimestamp RTK Query mutation entirely and replaced it with a direct getIpcApi().updateConnectedWpcomSites() call from the thunks. Done as part of e176572.
Replace the RTK Query mutation with a plain async function that calls getIpcApi().updateConnectedWpcomSites() directly from the thunks. Await the timestamp write before invalidating the cache to avoid a race where the re-fetch reads stale data.
sejas
left a comment
There was a problem hiding this comment.
I tested the the deep link and also puling a new site. I confirm both worked and I saw the tooltip with latest pull timestamp.
Related issues
How AI was used in this PR
AI was used to implement and verify the refactor. All changes were reviewed for correctness.
Proposed Changes
updateSingleConnectedWpcomSiteIPC handler, which duplicated logic already present inupdateConnectedWpcomSitesconnected-sites.tsanduse-listen-deep-link-connection.tsto use the bulk handler with the single site wrapped in an arrayipc-handlers.ts), preload bridge (preload.ts), and test mockslastPullTimestamp/lastPushTimestampupdates on push/pull success — these were accidentally dropped in Move pull and push states from SyncSitesProvider to a new Redux slice #2037 when push/pull states moved fromSyncSitesProviderto a Redux slice. TheuseUpdateSiteTimestampMutationwas left as dead code, never called from the new thunks.Testing Instructions
~/Library/Application Support/Studio/appdata-v1.jsonand confirmlastPullTimestamp/lastPushTimestampare set after syncPre-merge Checklist