From c7454cb07431ea79686b13d1fe7681620e29081c Mon Sep 17 00:00:00 2001 From: Ian <55458524+ikjudd@users.noreply.github.com> Date: Fri, 12 May 2023 13:41:27 -0400 Subject: [PATCH] dashboard route bug (#1051) * updated useEffect in profilePage so router path looks for dashboard path before rerouting * User balance lookup (#1048) * display wallet in dash to onboarding whitelist addresses and show bundlr balance in user balances * formatted * created and implemented two functions for getting user sol and usdc balance * updated function name * refactored usdc ui for balance * refactored getusdcforpublickey and getsolbalanceforpublickey to return a value instead of setting state in global context * renamed handlers and getbundlrbalanceforuser * refactored * refactored bundlr sol and usdc handler to run only if in admin mode * renamed admin variable * refactored solBalance * refactored balances in markup * renamed hasAccess * display upload account space available and refactored box for responsiveness * fix width issue * updated dependency in useEffect * fixed dependency array --- js/web/pages/profiles/[profilePubkey]/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/web/pages/profiles/[profilePubkey]/index.js b/js/web/pages/profiles/[profilePubkey]/index.js index cbadce60..643a220a 100644 --- a/js/web/pages/profiles/[profilePubkey]/index.js +++ b/js/web/pages/profiles/[profilePubkey]/index.js @@ -15,12 +15,13 @@ const ProfilePage = (props) => { const { profilePubkey, loading } = props const { wallet } = useContext(Wallet.Context) const router = useRouter() - + const dashboardPath = `/profiles/${wallet.publicKey?.toBase58()}` + const routerPath = router.asPath useEffect(() => { - if (wallet.connected && profilePubkey === wallet.publicKey?.toBase58()) { + if (routerPath === dashboardPath) { router.push('/dashboard') } - }, [wallet, profilePubkey]) + }, [routerPath]) return ( <>