Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fixing reload issues

uggrock258a9c1ac1b6
diff --git a/data/electron/main.js b/data/electron/main.js
index c2f993c78..3f339a65d 100644
--- a/data/electron/main.js
+++ b/data/electron/main.js
@@ -90,13 +90,16 @@ ipcMain.on("new-win", () => {
let execPath = 'file://' + path.dirname(__dirname) + '/index.html';
-ipcMain.on('relaunch-app', (e, arg) => {
+ipcMain.on('relaunch-app', reloadApp);
+
+function reloadApp() {
if (mainWindow) {
mainWindow.loadURL(execPath);
- } else {
+ }
+ if (newWindow) {
newWindow.loadURL(execPath);
}
-});
+}
app.on('ready', (event) => {
//console.log(app.getLocale());
@@ -156,7 +159,7 @@ app.on('ready', (event) => {
dialog.showMessageBox(mainWindow, options, (index) => {
mainWindow.hide();
if (index === 0) {
- mainWindow.reload();
+ reloadApp();
} else {
mainWindow.close();
}
@@ -347,25 +350,5 @@ process.on('uncaughtException', (error) => {
if (error.stack) {
console.error('error:', error.stack);
}
- if (mainWindow) {
- mainWindow.reload();
- } else {
- newWindow.reload();
- }
- // Handle the error
- /*if (error) {
- const options = {
- type: 'info',
- title: 'Renderer Process Crashed',
- message: 'This process has crashed.',
- buttons: ['Reload', 'Close']
- };
- dialog.showMessageBox(mainWindow, options, function(index) {
- if (index === 0) {
- mainWindow.reload();
- } else {
- mainWindow.close();
- }
- });
- }*/
+ reloadApp();
});
\ No newline at end of file