Skip to content

Commit 3854cd4

Browse files
committed
feat: add dev mode check for devtools extension and fix route hash handling in window loading
1 parent c7fca78 commit 3854cd4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/main/createWindow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const createWindow = (routePath = '/') => {
5858
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
5959
await window.loadURL(`${process.env['ELECTRON_RENDERER_URL']}/index.html#${routePath}`)
6060
} else {
61-
await window.loadFile(path.join(__dirname, `../renderer/index.html#${routePath}`))
61+
await window.loadFile(path.join(__dirname, `../renderer/index.html`), { hash: routePath })
6262
}
6363
}
6464

src/main/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MqttConnection, MqttConnectionStatus } from '../types/mqtt-connection'
22
import { getGraphWindow, initGraphWindowHandlers } from './windowGraph'
33
import { app, BrowserWindow, dialog, ipcMain, shell } from 'electron'
4-
import { electronApp, optimizer } from '@electron-toolkit/utils'
4+
import { electronApp, is, optimizer } from '@electron-toolkit/utils'
55
import installExtension from 'electron-devtools-installer'
66
import { initDataGraphHandlers } from './stores/dataGraph'
77
import { HasAutoUpdate } from './constants/hasAutoUpdate'
@@ -48,9 +48,11 @@ app.whenReady().then(() => {
4848
optimizer.watchWindowShortcuts(window)
4949
})
5050

51-
installExtension('nhdogjmejiglipccpnnnanhbledajbpd')
52-
.then((extension) => console.log(`Added Extension: ${extension.name}`))
53-
.catch((err) => console.log('An error occurred: ', err))
51+
if (is.dev) {
52+
installExtension('nhdogjmejiglipccpnnnanhbledajbpd')
53+
.then((extension) => console.log(`Added Extension: ${extension.name}`))
54+
.catch((err) => console.log('An error occurred: ', err))
55+
}
5456

5557
mainWindow = createWindow()
5658

0 commit comments

Comments
 (0)