Skip to content

Commit 1a39aee

Browse files
committed
fix: logic checks
1 parent 8029ce8 commit 1a39aee

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

src/backend/main.ts

+19-20
Original file line numberDiff line numberDiff line change
@@ -719,28 +719,27 @@ ipcMain.once('frontendReady', async () => {
719719
logInfo('Frontend Ready', LogPrefix.Backend)
720720
const currentVersion = app.getVersion()
721721
const lastVersion = configStore.get('appVersion', '')
722+
const walletStateIsConnected = configStore.get(
723+
'walletState.isConnected',
724+
false
725+
)
722726

723-
if (!lastVersion || lastVersion !== currentVersion) {
724-
// Only initialize extension and reload if a wallet is connected
725-
const walletStateIsConnected = configStore.get(
726-
'walletState.isConnected',
727-
false
727+
await initExtension(hpApi)
728+
729+
// Only reload the app if a wallet is not connected
730+
// or the app version has changed
731+
if (
732+
!walletStateIsConnected ||
733+
!lastVersion ||
734+
lastVersion !== currentVersion
735+
) {
736+
logInfo(
737+
'App version changed and wallet connected, reloading to update MM',
738+
LogPrefix.Backend
728739
)
729-
if (walletStateIsConnected) {
730-
logInfo(
731-
'App version changed and wallet connected, reloading to update MM',
732-
LogPrefix.Backend
733-
)
734-
await initExtension(hpApi)
735-
// wait for mm SW to initialize
736-
await wait(5000)
737-
ipcMain.emit('reloadApp')
738-
} else {
739-
logInfo(
740-
'App version changed but no wallet connected, skipping MM update',
741-
LogPrefix.Backend
742-
)
743-
}
740+
// wait for mm SW to initialize
741+
await wait(5000)
742+
ipcMain.emit('reloadApp')
744743
}
745744

746745
handleProtocol([openUrlArgument, ...process.argv])

0 commit comments

Comments
 (0)