Skip to content

Commit

Permalink
Merge pull request #1351 from multiversx/development
Browse files Browse the repository at this point in the history
v3.1.5
  • Loading branch information
razvantomegea authored Dec 17, 2024
2 parents fcd201f + c083176 commit 25bbbe8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 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.5](https://github.com/multiversx/mx-sdk-dapp/pull/1351)] - 2024-12-17

- [Fixed cross window page reload on internal logout](https://github.com/multiversx/mx-sdk-dapp/pull/1350)

## [[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)
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.4",
"version": "3.1.5",
"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
9 changes: 7 additions & 2 deletions src/utils/logout.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { safeWindow } from 'lib/sdkDappUtils';
import { CrossWindowProvider } from 'lib/sdkWebWalletCrossWindowProvider';
import { getAccountProvider, getProviderType } from 'providers';
import { logoutAction } from 'reduxStore/commonActions';
Expand Down Expand Up @@ -70,13 +71,17 @@ export async function logout(

const url = addOriginToLocationPath(callbackUrl);
const location = getWindowLocation();
const callbackPathname = new URL(decodeURIComponent(url)).pathname;
const { pathname: callbackPathname, origin: callbackOrigin } = new URL(
decodeURIComponent(url)
);

// Prevent page redirect if the logout callbackURL is equal to the current URL
// or if is wallet provider
// or if we are in a child tab (redirects via window.assign cause automatic tab close)
if (
matchPath(location.pathname, callbackPathname) ||
(isWalletProvider && isProviderInitialised)
(isWalletProvider && isProviderInitialised) ||
(safeWindow?.opener && callbackOrigin === safeWindow?.origin)
) {
preventRedirects();
}
Expand Down

0 comments on commit 25bbbe8

Please sign in to comment.