Skip to content

Commit

Permalink
Remove error toastr
Browse files Browse the repository at this point in the history
  • Loading branch information
pythongosssss committed Dec 23, 2024
1 parent 8511144 commit 74e7d4c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 44 deletions.
2 changes: 0 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export const IPC_CHANNELS = {
VALIDATE_COMFYUI_SOURCE: 'validate-comfyui-source',
SHOW_DIRECTORY_PICKER: 'show-directory-picker',
INSTALL_COMFYUI: 'install-comfyui',
SHOW_TOAST: 'show-toast',
LOADED: 'loaded',
SHOW_CONTEXT_MENU: 'show-context-menu',
RESTART_CORE: 'restart-core',
GET_GPU: 'get-gpu',
Expand Down
11 changes: 0 additions & 11 deletions src/main-process/appWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,6 @@ export class AppWindow {
});
}

/**
* Shows a toast popup in the client
*/
showToast(config: {
severity?: 'success' | 'info' | 'warn' | 'error' | 'secondary' | 'contrast' | undefined;
summary?: string | undefined;
detail?: any | undefined;
}): void {
this.send(IPC_CHANNELS.SHOW_TOAST, config);
}

public onClose(callback: () => void): void {
this.window.on('close', () => {
callback();
Expand Down
17 changes: 7 additions & 10 deletions src/main-process/comfyDesktopApp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, dialog, ipcMain } from 'electron';
import { app, dialog, ipcMain, Notification } from 'electron';
import log from 'electron-log/main';
import * as Sentry from '@sentry/electron/main';
import { graphics } from 'systeminformation';
Expand Down Expand Up @@ -250,15 +250,12 @@ export class ComfyDesktopApp {
await this.comfyServer.start();
this.initializeTerminal(virtualEnvironment);

return () => {
if (customNodeMigrationError) {
this.appWindow.showToast({
summary: 'Failed to migrate custom nodes',
detail: customNodeMigrationError,
severity: 'error',
});
}
};
if (customNodeMigrationError) {
new Notification({
title: 'Failed to migrate custom nodes',
body: customNodeMigrationError,
}).show();
}
}

async migrateCustomNodes(config: DesktopConfig, virtualEnvironment: VirtualEnvironment, callbacks: ProcessCallbacks) {
Expand Down
8 changes: 1 addition & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,11 @@ async function startApp() {
delete extraServerArgs.listen;
delete extraServerArgs.port;

let onReady: (() => void) | null = null;
if (!useExternalServer) {
onReady = await comfyDesktopApp.startComfyServer({ host, port, extraServerArgs });
await comfyDesktopApp.startComfyServer({ host, port, extraServerArgs });
}
appWindow.sendServerStartProgress(ProgressStatus.READY);

const waitLoad = Promise.withResolvers();
ipcMain.handle(IPC_CHANNELS.LOADED, waitLoad.resolve);
await appWindow.loadComfyUI({ host, port, extraServerArgs });
await waitLoad.promise;
onReady?.();
} catch (error) {
log.error('Unhandled exception during app startup', error);
appWindow.sendServerStartProgress(ProgressStatus.ERROR);
Expand Down
14 changes: 0 additions & 14 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,6 @@ const electronAPI = {
installComfyUI: (installOptions: InstallOptions) => {
ipcRenderer.send(IPC_CHANNELS.INSTALL_COMFYUI, installOptions);
},
/**
* Shows a toast popup with the supplied config
*/
onShowToast: (callback: (config: { message: string; type: string }) => void) => {
ipcRenderer.on(IPC_CHANNELS.SHOW_TOAST, (_event, value) => {
callback(value);
});
},
/**
* Trigged by the frontend app when it is loaded
*/
loaded: (): Promise<string> => {
return ipcRenderer.invoke(IPC_CHANNELS.LOADED);
},
/**
* Opens native context menus.
*
Expand Down

0 comments on commit 74e7d4c

Please sign in to comment.