From a85390b2899832e589121c4966d1dac24752ee91 Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 18 Dec 2025 15:49:49 +0100 Subject: [PATCH] feat: apply coderabbit suggestions --- apps/ui/src/main.ts | 15 ++++++++++++--- apps/ui/vite.config.mts | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/ui/src/main.ts b/apps/ui/src/main.ts index b04a75af..e22edc0d 100644 --- a/apps/ui/src/main.ts +++ b/apps/ui/src/main.ts @@ -364,14 +364,20 @@ app.on("before-quit", () => { // Native file dialogs ipcMain.handle("dialog:openDirectory", async () => { - const result = await dialog.showOpenDialog(mainWindow!, { + if (!mainWindow) { + return { canceled: true, filePaths: [] }; + } + const result = await dialog.showOpenDialog(mainWindow, { properties: ["openDirectory", "createDirectory"], }); return result; }); ipcMain.handle("dialog:openFile", async (_, options = {}) => { - const result = await dialog.showOpenDialog(mainWindow!, { + if (!mainWindow) { + return { canceled: true, filePaths: [] }; + } + const result = await dialog.showOpenDialog(mainWindow, { properties: ["openFile"], ...options, }); @@ -379,7 +385,10 @@ ipcMain.handle("dialog:openFile", async (_, options = {}) => { }); ipcMain.handle("dialog:saveFile", async (_, options = {}) => { - const result = await dialog.showSaveDialog(mainWindow!, options); + if (!mainWindow) { + return { canceled: true, filePath: undefined }; + } + const result = await dialog.showSaveDialog(mainWindow, options); return result; }); diff --git a/apps/ui/vite.config.mts b/apps/ui/vite.config.mts index 25376c82..220cbb49 100644 --- a/apps/ui/vite.config.mts +++ b/apps/ui/vite.config.mts @@ -61,7 +61,7 @@ export default defineConfig(({ command }) => { }, }, server: { - port: 3007, + port: parseInt(process.env.TEST_PORT || "3007", 10), }, build: { outDir: "dist",