Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
71bdc14
Installed `tus-js-client` version 4.3.1
gavande1 Dec 8, 2025
145f286
Add studio file upload constants
gavande1 Dec 8, 2025
b1998ed
Upload file using tus protocol
gavande1 Dec 8, 2025
8fbdfbf
Add support for file upload pause and resume states
gavande1 Dec 8, 2025
b5e11c3
Add cleanup function in pushArchive function clear file streams
gavande1 Dec 8, 2025
a1efd63
Refactor pushArchive function to include selectedSiteId as a parameter
gavande1 Dec 8, 2025
33c30e4
Add 'uploadingPaused' state check and tooltip notification for connec…
gavande1 Dec 9, 2025
4ca8b4c
Remove 'uploadingPaused' state from the list of active upload states
gavande1 Dec 9, 2025
521af7f
Update API path to initiate sync import
gavande1 Dec 10, 2025
961df22
Refactor logic to handle file cleanup after upload completion
gavande1 Dec 10, 2025
773f555
Remove constants and use values
gavande1 Dec 10, 2025
264c01b
Simplify parameter types for request handlers
gavande1 Dec 10, 2025
df5adf6
Remove 'uploadingResumed' state from sync progress info
gavande1 Dec 10, 2025
baa2bec
Rename IPC events for file upload pause and resume
gavande1 Dec 10, 2025
963ff3d
Remove unused imports
gavande1 Dec 10, 2025
157addf
Update logic to track upload start state and update UI when uploading…
gavande1 Dec 10, 2025
d853ff8
Resolve merge conflicts
gavande1 Dec 10, 2025
34577dd
Remove unnecessary parameters and logging
gavande1 Dec 11, 2025
c00837d
Add error logging for paused uploads in TUS handler
gavande1 Dec 11, 2025
9275e52
Update header key for attachment id for pushing archives
gavande1 Dec 15, 2025
5aa55de
Add handling for 403 error status in TUS upload retry logic
gavande1 Dec 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 82 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"strip-ansi": "^7.1.2",
"tar": "^7.5.2",
"ts-node": "^10.9.2",
"tus-js-client": "^4.3.1",
"unzipper": "^0.12.3",
"winreg": "^1.2.5",
"wpcom": "^7.1.1",
Expand Down
20 changes: 20 additions & 0 deletions src/hooks/sync-sites/use-sync-push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
usePullPushStates,
} from 'src/hooks/sync-sites/use-pull-push-states';
import { useAuth } from 'src/hooks/use-auth';
import { useIpcListener } from 'src/hooks/use-ipc-listener';
import {
useSyncStatesProgressInfo,
PushStateProgressInfo,
Expand Down Expand Up @@ -308,6 +309,7 @@ export function useSyncPush( {

try {
const response = await getIpcApi().pushArchive(
selectedSite.id,
remoteSiteId,
archivePath,
options?.optionsToSync,
Expand Down Expand Up @@ -378,6 +380,24 @@ export function useSyncPush( {
isKeyCancelled,
] );

useIpcListener(
'sync-upload-paused',
( _event, payload: { selectedSiteId: string; remoteSiteId: number; error: string } ) => {
updatePushState( payload.selectedSiteId, payload.remoteSiteId, {
status: pushStatesProgressInfo.uploadingPaused,
} );
}
);

useIpcListener(
'sync-upload-resumed',
( _event, payload: { selectedSiteId: string; remoteSiteId: number } ) => {
updatePushState( payload.selectedSiteId, payload.remoteSiteId, {
status: pushStatesProgressInfo.uploading,
} );
}
);

const isAnySitePushing = useMemo< boolean >( () => {
return Object.values( pushStates ).some( ( state ) => isKeyPushing( state.status.key ) );
}, [ pushStates, isKeyPushing ] );
Expand Down
13 changes: 12 additions & 1 deletion src/hooks/use-sync-states-progress-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export type PushStateProgressInfo = {
| 'finishing'
| 'finished'
| 'failed'
| 'cancelled';
| 'cancelled'
| 'uploadingPaused';
progress: number;
message: string;
};
Expand Down Expand Up @@ -105,6 +106,11 @@ export function useSyncStatesProgressInfo() {
progress: 40,
message: __( 'Uploading Studio site…' ),
},
uploadingPaused: {
key: 'uploadingPaused',
progress: 45,
message: __( 'Uploading paused' ),
},
creatingRemoteBackup: {
key: 'creatingRemoteBackup',
progress: 50,
Expand Down Expand Up @@ -164,6 +170,10 @@ export function useSyncStatesProgressInfo() {
return pushingStateKeys.includes( key );
};

const isKeyUploadingPaused = ( key: PushStateProgressInfo[ 'key' ] | undefined ) => {
return key === 'uploadingPaused';
};

const isKeyImporting = ( key: PushStateProgressInfo[ 'key' ] | undefined ) => {
const pushingStateKeys: PushStateProgressInfo[ 'key' ][] = [
'creatingRemoteBackup',
Expand Down Expand Up @@ -296,5 +306,6 @@ export function useSyncStatesProgressInfo() {
getBackupStatusWithProgress,
getPullStatusWithProgress,
getPushStatusWithProgress,
isKeyUploadingPaused,
};
}
2 changes: 2 additions & 0 deletions src/ipc-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export interface IpcEvents {
},
];
'site-context-menu-action': [ { action: string; siteId: string } ];
'sync-upload-paused': [ { error: string; selectedSiteId: string; remoteSiteId: number } ];
'sync-upload-resumed': [ { selectedSiteId: string; remoteSiteId: number } ];
'snapshot-error': [ { operationId: crypto.UUID; data: SnapshotEventData } ];
'snapshot-fatal-error': [ { operationId: crypto.UUID; data: { message: string } } ];
'snapshot-output': [ { operationId: crypto.UUID; data: SnapshotEventData } ];
Expand Down
18 changes: 17 additions & 1 deletion src/modules/sync/components/sync-connected-sites.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Icon } from '@wordpress/components';
import { createInterpolateElement } from '@wordpress/element';
import { sprintf } from '@wordpress/i18n';
import { cloudUpload, cloudDownload, info, close } from '@wordpress/icons';
import { cloudUpload, cloudDownload, info, close, error } from '@wordpress/icons';
import { useI18n } from '@wordpress/react-i18n';
import { useState } from 'react';
import { ArrowIcon } from 'src/components/arrow-icon';
Expand Down Expand Up @@ -199,6 +199,7 @@ const SyncConnectedSitesSectionItem = ( {
isKeyFailed,
isKeyCancelled,
getPullStatusWithProgress,
isKeyUploadingPaused,
} = useSyncStatesProgressInfo();

const sitePullState = getPullState( selectedSite.id, connectedSite.id );
Expand All @@ -211,6 +212,7 @@ const SyncConnectedSitesSectionItem = ( {

const pushState = getPushState( selectedSite.id, connectedSite.id );
const isPushing = pushState && isKeyPushing( pushState.status.key );
const isUploadingPaused = pushState && isKeyUploadingPaused( pushState.status.key );
const isPushError = pushState && isKeyFailed( pushState.status.key );
const hasPushFinished = pushState && isKeyFinished( pushState.status.key );
const hasPushCancelled = pushState && isKeyCancelled( pushState.status.key );
Expand Down Expand Up @@ -292,6 +294,19 @@ const SyncConnectedSitesSectionItem = ( {
{ __( 'Pull complete' ) }
</ClearAction>
) }
{ pushState?.status && isUploadingPaused && (
<Tooltip
text={ __(
'The site uploading has been paused due to an internet connection issue. We will retry automatically in a few seconds.'
) }
placement="top-start"
>
<Button variant="link" disabled={ true }>
<Icon icon={ error } />
{ pushState.status.message }
</Button>
</Tooltip>
) }
{ pushState?.status && isPushing && (
<div className="flex items-center gap-2 max-w-full">
<Tooltip
Expand Down Expand Up @@ -347,6 +362,7 @@ const SyncConnectedSitesSectionItem = ( {
! isPullError &&
! isPushError &&
! isPushing &&
! isUploadingPaused &&
! hasPushFinished &&
! hasPullCancelled &&
! hasPushCancelled && (
Expand Down
Loading