Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.2.7](https://github.com/multiversx/mx-sdk-dapp/pull/1384)] - 2025-03-11

- [Fixed cancel action is not called on all providers](https://github.com/multiversx/mx-sdk-dapp/pull/1383)

## [[v3.2.6](https://github.com/multiversx/mx-sdk-dapp/pull/1382)] - 2025-03-11

- [Fixed sign screen layout and move decoder styles inside the package](https://github.com/multiversx/mx-sdk-dapp/pull/1381)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import { DataTestIdsEnum } from 'constants/index';
import { withStyles, WithStylesImportType } from 'hocs/withStyles';
import { useClearTransactionsToSignWithWarning } from 'hooks/transactions/helpers/useClearTransactionsToSignWithWarning';
import { useCancelCrossWindowAction } from 'hooks/transactions/useCancelCrossWindowAction';
import { useCancelActionAndDispose } from 'hooks/transactions/useCancelActionAndDispose';
import { SignModalPropsType } from 'types';
import { ModalContainer } from 'UI/ModalContainer/ModalContainer';
import { PageState } from 'UI/PageState';
Expand All @@ -25,7 +25,7 @@ const SignWaitingScreenModalComponent = ({
globalStyles,
styles
}: SignWaitingScreenModalPropsType & WithStylesImportType) => {
const cancelAction = useCancelCrossWindowAction();
const cancelAction = useCancelActionAndDispose();

const clearTransactionsToSignWithWarning =
useClearTransactionsToSignWithWarning();
Expand Down
38 changes: 38 additions & 0 deletions src/hooks/transactions/useCancelActionAndDispose.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useGetAccountProvider } from 'hooks/account/useGetAccountProvider';
import { LoginMethodsEnum } from 'types/enums.types';
import { getIsProviderEqualTo } from 'utils/account/getIsProviderEqualTo';
import { useCancelWalletConnectAction } from './useCancelWalletConnectAction';

export function useCancelActionAndDispose() {
const { provider } = useGetAccountProvider();
const { cancelWalletConnectAction } = useCancelWalletConnectAction();

return async () => {
if (!provider) {
return;
}

if (getIsProviderEqualTo(LoginMethodsEnum.walletconnectv2)) {
await cancelWalletConnectAction();
return;
}

try {
if (
'cancelAction' in provider &&
typeof provider.cancelAction === 'function'
) {
await provider.cancelAction();
}

if ('dispose' in provider && typeof provider.dispose === 'function') {
await provider.dispose();
}
} catch (error) {
console.info('Failed to cancel action and/or dispose provider: ', {
provider,
error
});
}
};
}
20 changes: 0 additions & 20 deletions src/hooks/transactions/useCancelCrossWindowAction.ts

This file was deleted.