-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
89 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
import { useEffect } from 'react' | ||
import { useSelector } from 'react-redux' | ||
import { useHistory } from 'react-router-dom' | ||
import { useNavigate } from 'react-router-dom' | ||
|
||
import { selectActiveWalletId, selectAddress } from 'app/state/wallet/selectors' | ||
|
||
export const useRouteRedirects = () => { | ||
const activeWalletIndex = useSelector(selectActiveWalletId) | ||
const address = useSelector(selectAddress) | ||
const history = useHistory() | ||
const navigate = useNavigate() | ||
|
||
useEffect(() => { | ||
if (typeof activeWalletIndex !== 'undefined' && address) { | ||
history.push(`/account/${address}`) | ||
navigate(`/account/${address}`) | ||
} | ||
}, [activeWalletIndex, address, history]) | ||
// omit navigate dependency as it is not stable | ||
// https://github.com/remix-run/react-router/issues/7634 | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [activeWalletIndex, address]) | ||
} |
Oops, something went wrong.