diff --git a/src/main/preload.ts b/src/main/preload.ts index d1daf24da..ee449b128 100644 --- a/src/main/preload.ts +++ b/src/main/preload.ts @@ -53,7 +53,7 @@ const saveFileToDisk = async (path: string, file: any) => { const selectRootDirectory = async () => { try { - return await ipcRenderer.sendSync('select-dir'); + return await ipcRenderer.invoke('select-dir'); } catch (e) { console.error(e); throw e; diff --git a/src/main/utils/ipcComms.ts b/src/main/utils/ipcComms.ts index cb30a8922..f685bb13a 100644 --- a/src/main/utils/ipcComms.ts +++ b/src/main/utils/ipcComms.ts @@ -7,7 +7,7 @@ export default function setupIpcComs( tray: Tray, mainWindow: BrowserWindow ): void { - ipcMain.on('select-dir', async (event) => { + ipcMain.handle('select-dir', async () => { const dialogWindow = new BrowserWindow({ width: 800, height: 600, @@ -25,7 +25,7 @@ export default function setupIpcComs( result.filePaths.length > 0 && result.filePaths[0]; dialogWindow.close(); - event.returnValue = dir; + return dir; }); ipcMain.on('update-tray', (event, args) => { diff --git a/src/main/utils/upload.ts b/src/main/utils/upload.ts index 3e375e069..e21cc1c01 100644 --- a/src/main/utils/upload.ts +++ b/src/main/utils/upload.ts @@ -75,7 +75,7 @@ export const setToUploadFiles = ( if (filePaths && filePaths.length > 0) { uploadStatusStore.set('filePaths', filePaths); } else { - uploadStatusStore.delete('filePaths'); + uploadStatusStore.set('filePaths', []); } if (collectionName) { uploadStatusStore.set('collectionName', collectionName);