Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
04164a55
Unverified
Commit
04164a55
authored
Sep 20, 2022
by
vignesh mohankumar
Committed by
GitHub
Sep 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: close WalletModal on connection (#4670)
* fix: close WalletModal on connection * fix test
parent
16a5e150
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
wallet.test.ts
cypress/e2e/wallet.test.ts
+1
-0
index.tsx
src/components/WalletModal/index.tsx
+9
-0
No files found.
cypress/e2e/wallet.test.ts
View file @
04164a55
...
@@ -24,6 +24,7 @@ describe('Wallet', () => {
...
@@ -24,6 +24,7 @@ describe('Wallet', () => {
})
})
it
(
'
shows connect buttons after disconnect
'
,
()
=>
{
it
(
'
shows connect buttons after disconnect
'
,
()
=>
{
cy
.
get
(
'
[data-testid=web3-status-connected]
'
).
contains
(
TEST_ADDRESS_NEVER_USE_SHORTENED
).
click
()
cy
.
contains
(
'
Disconnect
'
).
click
()
cy
.
contains
(
'
Disconnect
'
).
click
()
cy
.
get
(
'
[data-testid=option-grid]
'
).
should
(
'
exist
'
)
cy
.
get
(
'
[data-testid=option-grid]
'
).
should
(
'
exist
'
)
})
})
...
...
src/components/WalletModal/index.tsx
View file @
04164a55
...
@@ -8,6 +8,7 @@ import { AutoColumn } from 'components/Column'
...
@@ -8,6 +8,7 @@ import { AutoColumn } from 'components/Column'
import
{
AutoRow
}
from
'
components/Row
'
import
{
AutoRow
}
from
'
components/Row
'
import
{
getConnection
,
getConnectionName
,
getIsCoinbaseWallet
,
getIsInjected
,
getIsMetaMask
}
from
'
connection/utils
'
import
{
getConnection
,
getConnectionName
,
getIsCoinbaseWallet
,
getIsInjected
,
getIsMetaMask
}
from
'
connection/utils
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
{
RedesignVariant
,
useRedesignFlag
}
from
'
featureFlags/flags/redesign
'
import
usePrevious
from
'
hooks/usePrevious
'
import
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
import
{
useCallback
,
useEffect
,
useState
}
from
'
react
'
import
{
ArrowLeft
}
from
'
react-feather
'
import
{
ArrowLeft
}
from
'
react-feather
'
import
{
updateConnectionError
}
from
'
state/connection/reducer
'
import
{
updateConnectionError
}
from
'
state/connection/reducer
'
...
@@ -149,6 +150,8 @@ export default function WalletModal({
...
@@ -149,6 +150,8 @@ export default function WalletModal({
})
{
})
{
const
dispatch
=
useAppDispatch
()
const
dispatch
=
useAppDispatch
()
const
{
connector
,
account
,
chainId
}
=
useWeb3React
()
const
{
connector
,
account
,
chainId
}
=
useWeb3React
()
const
previousAccount
=
usePrevious
(
account
)
const
[
connectedWallets
,
addWalletToConnectedWallets
]
=
useConnectedWallets
()
const
[
connectedWallets
,
addWalletToConnectedWallets
]
=
useConnectedWallets
()
const
redesignFlag
=
useRedesignFlag
()
const
redesignFlag
=
useRedesignFlag
()
...
@@ -174,6 +177,12 @@ export default function WalletModal({
...
@@ -174,6 +177,12 @@ export default function WalletModal({
}
}
},
[
walletModalOpen
,
setWalletView
,
account
])
},
[
walletModalOpen
,
setWalletView
,
account
])
useEffect
(()
=>
{
if
(
account
&&
account
!==
previousAccount
&&
walletModalOpen
)
{
toggleWalletModal
()
}
},
[
account
,
previousAccount
,
toggleWalletModal
,
walletModalOpen
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
pendingConnector
&&
walletView
!==
WALLET_VIEWS
.
PENDING
)
{
if
(
pendingConnector
&&
walletView
!==
WALLET_VIEWS
.
PENDING
)
{
updateConnectionError
({
connectionType
:
getConnection
(
pendingConnector
).
type
,
error
:
undefined
})
updateConnectionError
({
connectionType
:
getConnection
(
pendingConnector
).
type
,
error
:
undefined
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment