Skip to content

Commit

Permalink
3.1.4 (#1349)
Browse files Browse the repository at this point in the history
* Fixed logout doesn't work when `shouldBroadcastLogoutAcrossTabs` is `false` (#1348)

* 3.1.4
  • Loading branch information
razvantomegea authored Dec 16, 2024
2 parents 7cfccfb + 9302e88 commit fcd201f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
11 changes: 3 additions & 8 deletions src/utils/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit fcd201f

Please sign in to comment.