From 23cd6ea58058fd673b7c25651beccd4778ffb8fd Mon Sep 17 00:00:00 2001 From: marcinbodnar Date: Thu, 14 Oct 2021 01:07:57 +0200 Subject: [PATCH] Use createMatchSelector selector in Profile component (#1966) --- packages/frontend/src/components/profile/Profile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/profile/Profile.js b/packages/frontend/src/components/profile/Profile.js index daa558cfd0..c4529db179 100644 --- a/packages/frontend/src/components/profile/Profile.js +++ b/packages/frontend/src/components/profile/Profile.js @@ -1,4 +1,5 @@ import BN from 'bn.js'; +import { createMatchSelector } from 'connected-react-router'; import { formatNearAmount } from 'near-api-js/lib/utils/format'; import React, { useEffect, useState } from 'react'; import { Translate } from 'react-localize-redux'; @@ -136,7 +137,7 @@ export function Profile({ match }) { const ledgerKey = useSelector((state) => selectAccountLedgerKey(state)); const loginAccountId = useSelector((state) => selectAccountId(state)); const nearTokenFiatValueUSD = useSelector((state) => selectNearTokenFiatValueUSD(state)); - const accountIdFromUrl = match.params.accountId; + const accountIdFromUrl = useSelector(createMatchSelector('/profile/:accountId'))?.params.accountId; const accountId = accountIdFromUrl || loginAccountId; const isOwner = accountId === loginAccountId; const account = useAccount(accountId);