diff options
| author | Oskar <oskar@mullvad.net> | 2025-10-08 13:51:29 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2025-10-09 13:21:11 +0200 |
| commit | 668fa98c9516c6c5bca9088ee082b84d0881d126 (patch) | |
| tree | 7f90c2ce50de5ed02d17468d2796ed94fc78b1d4 | |
| parent | ce0ddc8db47eb50f0acb0c66394baf9393d8b8e7 (diff) | |
| download | mullvadvpn-668fa98c9516c6c5bca9088ee082b84d0881d126.tar.xz mullvadvpn-668fa98c9516c6c5bca9088ee082b84d0881d126.zip | |
Notify renderer of device event before expiry when logging out
| -rw-r--r-- | desktop/packages/mullvad-vpn/src/main/account.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/desktop/packages/mullvad-vpn/src/main/account.ts b/desktop/packages/mullvad-vpn/src/main/account.ts index 7ee415c0b4..dc6e3f8f97 100644 --- a/desktop/packages/mullvad-vpn/src/main/account.ts +++ b/desktop/packages/mullvad-vpn/src/main/account.ts @@ -125,6 +125,14 @@ export default class Account { this.deviceStateValue = deviceEvent.deviceState; + void this.updateAccountHistory(); + this.delegate.onDeviceEvent(); + + // When logging out the renderer process needs to receive the device update before the account + // data update. This means that the ipc-call `account.notifyDevice` needs to be called before + // invalidating the accountDateCache since that triggers the ipc-call `account.notify`. + IpcMainEventChannel.account.notifyDevice?.(deviceEvent); + switch (deviceEvent.deviceState.type) { case 'logged in': this.accountDataCache.fetch(deviceEvent.deviceState.accountAndDevice.accountNumber); @@ -134,11 +142,6 @@ export default class Account { this.accountDataCache.invalidate(); break; } - - void this.updateAccountHistory(); - this.delegate.onDeviceEvent(); - - IpcMainEventChannel.account.notifyDevice?.(deviceEvent); } public setAccountHistory(accountHistory?: AccountNumber) { |
