From 88f3ab831c0b5905ec2442a94d4ac71fbb941516 Mon Sep 17 00:00:00 2001 From: Rahul Gavande Date: Tue, 30 Dec 2025 13:18:16 +0530 Subject: [PATCH 1/2] Fix renderer crash when network disconnects after upload - Add error handling in getPushProgressInfo to catch network errors gracefully - Skip Sentry reporting for expected crossDomain network errors - Prevent unhandled promise rejections when network goes offline Fixes STU-1180 --- src/hooks/sync-sites/use-sync-push.ts | 29 ++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/hooks/sync-sites/use-sync-push.ts b/src/hooks/sync-sites/use-sync-push.ts index 6552b0afe3..ffbbe1d829 100644 --- a/src/hooks/sync-sites/use-sync-push.ts +++ b/src/hooks/sync-sites/use-sync-push.ts @@ -142,12 +142,31 @@ export function useSyncPush( { return; } - const response = await client.req.get< ImportResponse >( - `/sites/${ remoteSiteId }/studio-app/sync/import`, - { - apiNamespace: 'wpcom/v2', + let response: ImportResponse; + try { + response = await client.req.get< ImportResponse >( + `/sites/${ remoteSiteId }/studio-app/sync/import`, + { + apiNamespace: 'wpcom/v2', + } + ); + } catch ( error ) { + // Network errors (e.g., offline) should be handled gracefully + // The error will be handled when the user comes back online + console.error( 'Failed to get push progress:', error ); + + // Skip Sentry reporting for expected network errors (crossDomain errors) + if ( + error instanceof Error && + 'crossDomain' in error && + ( error as Error & { crossDomain?: boolean } ).crossDomain + ) { + return; } - ); + + Sentry.captureException( error ); + return; + } let status: PushStateProgressInfo = pushStatesProgressInfo.creatingRemoteBackup; if ( response.success && response.status === 'finished' ) { From a1359a0501e1c4cee5fe71ddc7f9d11b8fe4d9a0 Mon Sep 17 00:00:00 2001 From: Rahul Gavande Date: Tue, 6 Jan 2026 14:39:01 +0530 Subject: [PATCH 2/2] remove unnecessary error logging --- src/hooks/sync-sites/use-sync-push.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/hooks/sync-sites/use-sync-push.ts b/src/hooks/sync-sites/use-sync-push.ts index ffbbe1d829..7d60b523a3 100644 --- a/src/hooks/sync-sites/use-sync-push.ts +++ b/src/hooks/sync-sites/use-sync-push.ts @@ -151,11 +151,8 @@ export function useSyncPush( { } ); } catch ( error ) { - // Network errors (e.g., offline) should be handled gracefully - // The error will be handled when the user comes back online - console.error( 'Failed to get push progress:', error ); - - // Skip Sentry reporting for expected network errors (crossDomain errors) + // Skip Sentry reporting for expected network errors (crossDomain errors). The client throws this error + // when the user is offline. if ( error instanceof Error && 'crossDomain' in error &&