Skip to content

Commit cf41910

Browse files
authored
fix: Account issued tokens (#1167)
## High Level Overview of Change <!-- Please include a summary/list of the changes. If too broad, please consider splitting into multiple PRs. --> The Issued Tokens page under Assets tab is not loading after the removal of redux. This PR will fix this issue. ### Type of Change <!-- Please check relevant options, delete irrelevant ones. --> - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Refactor (non-breaking change that only restructures code) - [ ] Tests (You added tests for code that already exists, or your new feature included in this PR) - [ ] Documentation Updates - [ ] Translation Updates - [ ] Release ## Before / After <!-- If just refactoring / back-end changes, this can be just an in-English description of the change at a technical level. If a UI change, screenshots should be included. --> ### Before ![Screenshot 2025-05-01 at 3 05 54 PM](https://github.com/user-attachments/assets/97736cb0-f506-4ba8-8343-f5ebef152bee) ### After ![Screenshot 2025-05-01 at 3 06 10 PM](https://github.com/user-attachments/assets/ab1a5153-a5a1-4029-8185-7ba447c2087b)
1 parent c818ade commit cf41910

File tree

3 files changed

+207
-245
lines changed

3 files changed

+207
-245
lines changed

src/containers/Accounts/AccountHeader/index.tsx

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import { useContext } from 'react'
21
import { Trans, useTranslation } from 'react-i18next'
3-
import { useQuery } from 'react-query'
4-
import { isValidClassicAddress, isValidXAddress } from 'ripple-address-codec'
5-
import { Loader } from '../../shared/components/Loader'
62
import './styles.scss'
73
import { BalanceSelector } from './BalanceSelector/BalanceSelector'
84
import { Account } from '../../shared/components/Account'
9-
import { BAD_REQUEST, localizeNumber } from '../../shared/utils'
10-
import SocketContext from '../../shared/SocketContext'
5+
import { localizeNumber } from '../../shared/utils'
116
import InfoIcon from '../../shared/images/info.svg'
127
import { useLanguage } from '../../shared/hooks'
138
import Currency from '../../shared/components/Currency'
149
import DomainLink from '../../shared/components/DomainLink'
15-
import { getAccountState } from '../../../rippled'
16-
import { useAnalytics } from '../../shared/analytics'
1710
import { AccountState } from '../../../rippled/accountState'
1811

1912
const CURRENCY_OPTIONS = {
@@ -26,39 +19,18 @@ const CURRENCY_OPTIONS = {
2619
interface AccountHeaderProps {
2720
onSetCurrencySelected: (currency: string) => void
2821
currencySelected: string
22+
account: any
2923
accountId: string
3024
}
3125

3226
export const AccountHeader = ({
27+
account,
3328
accountId,
3429
onSetCurrencySelected,
3530
currencySelected,
3631
}: AccountHeaderProps) => {
3732
const { t } = useTranslation()
38-
const rippledSocket = useContext(SocketContext)
3933
const language = useLanguage()
40-
const { trackException } = useAnalytics()
41-
42-
const { data: accountState, isLoading } = useQuery(
43-
['accountState', accountId],
44-
() => {
45-
if (!isValidClassicAddress(accountId) && !isValidXAddress(accountId)) {
46-
return Promise.reject(BAD_REQUEST)
47-
}
48-
49-
return getAccountState(accountId, rippledSocket).catch(
50-
(transactionRequestError) => {
51-
const status = transactionRequestError.code
52-
trackException(
53-
`ledger ${accountId} --- ${JSON.stringify(
54-
transactionRequestError,
55-
)}`,
56-
)
57-
return Promise.reject(status)
58-
},
59-
)
60-
},
61-
)
6234

6335
function renderBalancesSelector(data: AccountState) {
6436
const { balances = {} } = data
@@ -321,8 +293,8 @@ export const AccountHeader = ({
321293
)
322294
}
323295

324-
const xAddress = accountState?.xAddress ?? false
325-
const hasBridge = accountState?.hasBridge ?? false
296+
const xAddress = account?.xAddress ?? false
297+
const hasBridge = account?.hasBridge ?? false
326298

327299
return (
328300
<div className="box account-header">
@@ -334,8 +306,7 @@ export const AccountHeader = ({
334306
<h1 className={xAddress ? 'x-address' : 'classic'}>{accountId}</h1>
335307
</div>
336308
<div className="box-content">
337-
{isLoading && <Loader />}
338-
{accountState != null && renderHeaderContent(accountState)}
309+
{account != null && renderHeaderContent(account)}
339310
</div>
340311
</div>
341312
)

0 commit comments

Comments
 (0)