diff --git a/CHANGELOG.md b/CHANGELOG.md index b1bdeecf5..b78f78d2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [[v3.0.9](https://github.com/multiversx/mx-sdk-dapp/pull/1299)] - 2024-11-06 + +- [Fix clear initiated login](https://github.com/multiversx/mx-sdk-dapp/pull/1301) + ## [[v3.0.8](https://github.com/multiversx/mx-sdk-dapp/pull/1299)] - 2024-11-04 - [Update skip method to clear only initiated login state](https://github.com/multiversx/mx-sdk-dapp/pull/1298) - - [Updated Iframe provider imports](https://github.com/multiversx/mx-sdk-dapp/pull/1297) - [Fixed Iframe provider reload](https://github.com/multiversx/mx-sdk-dapp/pull/1295) diff --git a/package.json b/package.json index f76239fa7..95361f8ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@multiversx/sdk-dapp", - "version": "3.0.8", + "version": "3.0.9", "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/hooks/login/helpers/clearInitiatedLogins.ts b/src/hooks/login/helpers/clearInitiatedLogins.ts index ec158e3cd..20d96caaf 100644 --- a/src/hooks/login/helpers/clearInitiatedLogins.ts +++ b/src/hooks/login/helpers/clearInitiatedLogins.ts @@ -3,19 +3,29 @@ import { IframeProvider } from 'lib/sdkWebWalletIframeProvider'; import { LoginMethodsEnum } from 'types'; export const clearInitiatedLogins = (props?: { - intiatedLoginMethod: LoginMethodsEnum; + skipLoginMethod: LoginMethodsEnum; }) => { Object.values(LoginMethodsEnum).forEach((method) => { - if (props?.intiatedLoginMethod && method !== props.intiatedLoginMethod) { + if (method === props?.skipLoginMethod) { return; } - const crossWindowProvider = CrossWindowProvider.getInstance(); - if (crossWindowProvider.isInitialized()) { - crossWindowProvider.dispose(); - } - const iframeProvider = IframeProvider.getInstance(); - if (iframeProvider.isInitialized()) { - iframeProvider.dispose(); + switch (method) { + case LoginMethodsEnum.crossWindow: { + const crossWindowProvider = CrossWindowProvider.getInstance(); + if (crossWindowProvider.isInitialized()) { + crossWindowProvider.dispose(); + } + break; + } + case LoginMethodsEnum.iframe: { + const iframeProvider = IframeProvider.getInstance(); + if (iframeProvider.isInitialized()) { + iframeProvider.dispose(); + } + break; + } + default: + break; } }); diff --git a/src/hooks/login/useCrossWindowLogin.ts b/src/hooks/login/useCrossWindowLogin.ts index 5fcecbabb..27424cf23 100644 --- a/src/hooks/login/useCrossWindowLogin.ts +++ b/src/hooks/login/useCrossWindowLogin.ts @@ -53,7 +53,7 @@ export const useCrossWindowLogin = ({ } clearInitiatedLogins({ - intiatedLoginMethod: LoginMethodsEnum.crossWindow + skipLoginMethod: LoginMethodsEnum.crossWindow }); setIsLoading(true); diff --git a/src/hooks/login/useIframeLogin.ts b/src/hooks/login/useIframeLogin.ts index 3c8fb4ea2..d44b5bfb8 100644 --- a/src/hooks/login/useIframeLogin.ts +++ b/src/hooks/login/useIframeLogin.ts @@ -50,7 +50,7 @@ export const useIframeLogin = ({ } clearInitiatedLogins({ - intiatedLoginMethod: LoginMethodsEnum.iframe + skipLoginMethod: LoginMethodsEnum.iframe }); setIsLoading(true);