From 3f4d4828e051700f9047d311b98bec0e27653326 Mon Sep 17 00:00:00 2001 From: daryl Date: Tue, 27 Aug 2024 16:05:05 +0800 Subject: [PATCH] feat(rgbpp): use initial data --- src/pages/Address/BTCAddressComp.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/pages/Address/BTCAddressComp.tsx b/src/pages/Address/BTCAddressComp.tsx index 019fc8270..157eca617 100644 --- a/src/pages/Address/BTCAddressComp.tsx +++ b/src/pages/Address/BTCAddressComp.tsx @@ -25,11 +25,16 @@ export const BTCAddressOverviewCard: FC<{ address: Address }> = ({ address }) => ) const { boundLiveCellsCount, unboundLiveCellsCount } = data || { boundLiveCellsCount: 0, unboundLiveCellsCount: 0 } - let { data: udtAccounts } = useQuery(['bitcoin address udt accounts', address], async () => { - const data = await explorerService.api.fetchUDTAccountsByBtcAddress(address.bitcoinAddressHash || '') - return data.udtAccounts - }) - udtAccounts = udtAccounts || [] + const { data: udtAccounts } = useQuery( + ['bitcoin address udt accounts', address], + async () => { + const data = await explorerService.api.fetchUDTAccountsByBtcAddress(address.bitcoinAddressHash || '') + return data.udtAccounts + }, + { + initialData: [], + }, + ) const [udts, inscriptions] = udtAccounts.reduce( (acc, cur) => {