diff --git a/CHANGELOG.md b/CHANGELOG.md index f9ca31fb9..6d455efcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [[v3.1.4](https://github.com/multiversx/mx-sdk-dapp/pull/1349)] - 2024-12-16 + +- [Fixed logout doesn't work when `shouldBroadcastLogoutAcrossTabs` is `false`](https://github.com/multiversx/mx-sdk-dapp/pull/1348) + ## [[v3.1.3](https://github.com/multiversx/mx-sdk-dapp/pull/1347)] - 2024-12-13 - [Added session ID in the handshake payload to allow multiple DApp connections in parallel tabs](https://github.com/multiversx/mx-sdk-dapp/pull/1346) diff --git a/package.json b/package.json index 5964bdbeb..844ca38a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@multiversx/sdk-dapp", - "version": "3.1.3", + "version": "3.1.4", "description": "A library to hold the main logic for a dapp on the MultiversX blockchain", "author": "MultiversX", "license": "GPL-3.0-or-later", diff --git a/src/utils/logout.ts b/src/utils/logout.ts index 4a07aec75..c633b5f8d 100644 --- a/src/utils/logout.ts +++ b/src/utils/logout.ts @@ -54,7 +54,7 @@ export async function logout( hasConsentPopup: false } ) { - let address = ''; + const address = await getAddress(); const provider = getAccountProvider(); const providerType = getProviderType(provider); const isWalletProvider = providerType === LoginMethodsEnum.wallet; @@ -64,13 +64,8 @@ export async function logout( return provider.relogin(); } - if (options.shouldBroadcastLogoutAcrossTabs) { - try { - address = await getAddress(); - broadcastLogoutAcrossTabs(address); - } catch (err) { - console.error('error fetching logout address', err); - } + if (address && options.shouldBroadcastLogoutAcrossTabs) { + broadcastLogoutAcrossTabs(address); } const url = addOriginToLocationPath(callbackUrl);