● How do I use showOpenDialog withe Electron’s IPC?

Here is a working solution:

//  main.js
    ipcMain.on('open-file',(event,data)=>{
        dialog.showOpenDialog(null, data).then(filePaths => {
            event.sender.send('open-file-paths', filePaths);
        });
    });

//  pager.js (render)
    ipcRenderer.send('open-file',{
        title: 'Title',
        defaultPath: localStorage.getItem('defaultPath')
    });
    ipcRenderer.on('open-file-paths',(event,data)=>{
        console.log(`Canceled? ${data.canceled}`);
        console.log(`File Paths: ${data.filePaths.join(';')`);
    });

From: https://stackoverflow.com/questions/70331707/how-do-i-use-showopendialog-withe-electron-s-ipc