Skip to content

Commit

Permalink
Merge pull request #182 from chain4travel/fix-wallet-switcher
Browse files Browse the repository at this point in the history
add update wallet name to wallet component methods
  • Loading branch information
aeddaqqa authored Dec 29, 2023
2 parents 1ea29fb + 46a0b47 commit 1748af5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/Navbar/LoggedInAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const LoggedInAccount = () => {

useEffect(() => {
if (isMultiSigWallet()) {
setWalletName(getNameOfMultiSigWallet() || getPchainAddress()[0])
} else setWalletName(getPchainAddress()[0])
setWalletName(getNameOfMultiSigWallet() || pChainAddress || getPchainAddress()[0])
} else setWalletName(pChainAddress || getPchainAddress()[0])
}, [pChainAddress, activeNetwork])
return (
<>
Expand Down
7 changes: 6 additions & 1 deletion src/views/wallet/WalletApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useEffectOnce } from '../../hooks/useEffectOnce'
import {
updateAccount,
updateNotificationStatus,
updatePchainAddress,
updateShowButton,
updateValues,
} from '../../redux/slices/app-config'
Expand All @@ -17,8 +18,11 @@ const LoadWallet = () => {
const [logOut, setLogOut] = useState(false)
const dispatch = useAppDispatch()
const ref = useRef(null)
const [walletSwitched, setWalletSwitched] = React.useState('')
const navigate = useNavigate()

useEffect(() => {
dispatch(updatePchainAddress(walletSwitched))
}, [walletSwitched]) // eslint-disable-line react-hooks/exhaustive-deps
const dispatchNotification = ({ message, type }) =>
dispatch(updateNotificationStatus({ message, severity: type }))
const setAccount = account => dispatch(updateAccount(account))
Expand All @@ -44,6 +48,7 @@ const LoadWallet = () => {
dispatchNotification,
updateShowAlias,
navigate: location => navigate(location),
setWalletSwitched,
})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [fetch])
Expand Down

0 comments on commit 1748af5

Please sign in to comment.