Skip to content

Commit

Permalink
Fix bugs after clicking the wallet connect button
Browse files Browse the repository at this point in the history
- Do not trigger connection action again when wallet is selected
- Move the reset of errors to the `ConnectWalletButton`
  • Loading branch information
kkosiorowska committed Sep 23, 2024
1 parent 29cc5dd commit 9dee3b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export default function ConnectWalletButton({
} = useWallet()
const { signMessageStatus, resetMessageStatus, signMessageAndCreateSession } =
useSignMessageAndCreateSession()
const { setConnectionError } = useWalletConnectionError()
const { setConnectionError, resetConnectionError } =
useWalletConnectionError()
const { closeModal } = useModal()
const dispatch = useAppDispatch()

Expand Down Expand Up @@ -136,8 +137,11 @@ export default function ConnectWalletButton({
}, [connector])

const handleButtonClick = () => {
// Do not trigger action again when wallet connection is in progress
if (showStatuses) return

onDisconnect()
onClick()
resetConnectionError()
resetMessageStatus()

const isInstalled = orangeKit.isWalletInstalled(connector)
Expand All @@ -147,6 +151,7 @@ export default function ConnectWalletButton({
return
}

onClick()
handleConnection()
}

Expand Down
1 change: 0 additions & 1 deletion dapp/src/components/ConnectWalletModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function ConnectWalletModalBase({
const { connectionError, resetConnectionError } = useWalletConnectionError()

const handleButtonOnClick = (connector: OrangeKitConnector) => {
resetConnectionError()
setSelectedConnectorId(connector.id)
}

Expand Down

0 comments on commit 9dee3b5

Please sign in to comment.