@@ -62,28 +62,29 @@ function ensureThemeEnvironmentSetup(
6262 const abort = ( error : Error ) : never => {
6363 renderThrownError ( 'Failed to perform the initial theme synchronization.' , error )
6464 rejectBackgroundJob ( error )
65- throw error
65+ // Return a permanently pending promise to stop execution without throwing
66+ return new Promise < never > ( ( ) => { } ) as never
6667 }
6768
68- const remoteChecksumsPromise = fetchChecksums ( theme . id , ctx . session ) . catch ( abort )
69+ const remoteChecksumsPromise = fetchChecksums ( theme . id , ctx . session )
6970
70- const reconcilePromise = remoteChecksumsPromise
71- . then ( ( remoteChecksums ) => handleThemeEditorSync ( theme , ctx , remoteChecksums , rejectBackgroundJob ) )
72- . catch ( abort )
71+ const reconcilePromise = remoteChecksumsPromise . then ( ( remoteChecksums ) =>
72+ handleThemeEditorSync ( theme , ctx , remoteChecksums , rejectBackgroundJob ) ,
73+ )
7374
74- const uploadPromise = reconcilePromise
75- . then ( async ( { updatedRemoteChecksumsPromise} ) => {
76- const updatedRemoteChecksums = await updatedRemoteChecksumsPromise
77- return uploadTheme ( theme , ctx . session , updatedRemoteChecksums , ctx . localThemeFileSystem , {
78- nodelete : ctx . options . noDelete ,
79- deferPartialWork : true ,
80- backgroundWorkCatch : abort ,
81- } )
75+ const uploadPromise = reconcilePromise . then ( async ( { updatedRemoteChecksumsPromise} ) => {
76+ const updatedRemoteChecksums = await updatedRemoteChecksumsPromise
77+ return uploadTheme ( theme , ctx . session , updatedRemoteChecksums , ctx . localThemeFileSystem , {
78+ nodelete : ctx . options . noDelete ,
79+ deferPartialWork : true ,
80+ backgroundWorkCatch : abort ,
8281 } )
83- . catch ( abort )
82+ } )
83+
84+ const workPromise = uploadPromise . then ( ( result ) => result . workPromise ) . catch ( abort )
8485
8586 return {
86- workPromise : uploadPromise . then ( ( result ) => result . workPromise ) . catch ( abort ) ,
87+ workPromise,
8788 renderProgress : async ( ) => {
8889 if ( ctx . options . themeEditorSync ) {
8990 const { workPromise} = await reconcilePromise
0 commit comments