Skip to content

Commit

Permalink
Merge pull request #276 from lidofinance/fix/rollback-connect-wallet-btn
Browse files Browse the repository at this point in the history
fix: rollback "Connect wallet" eagerConnect behaviour
  • Loading branch information
jake4take authored Mar 13, 2024
2 parents d52a6ca + 1a74fda commit 0e99b88
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions shared/wallet/connect/connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,18 @@ import { wrapWithEventTrack } from '@lidofinance/analytics-matomo';
import { MATOMO_CLICK_EVENTS } from 'config';
import { useClientConfig } from 'providers/client-config';
import { useConnectWalletModal } from '../connect-wallet-modal/use-connect-wallet-modal';
import { useAutoConnectCheck, useEagerConnect } from 'reef-knot/core-react';

export const Connect: FC<ButtonProps> = (props) => {
const { isWalletConnectionAllowed } = useClientConfig();
const { onClick, ...rest } = props;
const { openModal } = useConnectWalletModal();
const { isAutoConnectionSuitable } = useAutoConnectCheck();
const { eagerConnect } = useEagerConnect();

const handleClick = wrapWithEventTrack(
MATOMO_CLICK_EVENTS.connectWallet,
useCallback(() => {
if (!isWalletConnectionAllowed) return;
// for auto-connect skip modal and try reconnect
if (isAutoConnectionSuitable) {
void eagerConnect();
} else {
openModal({});
}
}, [
eagerConnect,
isAutoConnectionSuitable,
isWalletConnectionAllowed,
openModal,
]),
openModal({});
}, [isWalletConnectionAllowed, openModal]),
);

return (
Expand Down

0 comments on commit 0e99b88

Please sign in to comment.