@@ -137,7 +137,6 @@ export default function PoolDetail({ params }: { params: { poolId: string } }) {
137137 const router = useRouter ( )
138138 const poolId = params . poolId
139139
140- const [ isInitialLoad , setIsInitialLoad ] = useState < boolean > ( true )
141140 const [ isOwnerTab , setIsOwnerTab ] = useState < boolean > ( false )
142141 const isMobile = useIsMobile ( )
143142
@@ -182,16 +181,7 @@ export default function PoolDetail({ params }: { params: { poolId: string } }) {
182181 }
183182 } , [ getTransactionsByPoolId . error , getTransactionsByPoolId . isError ] )
184183
185- useEffect ( ( ) => {
186- if ( ! ( getPoolById . isLoading || getTransactionsByPoolId . isLoading ) ) {
187- setIsInitialLoad ( false )
188- }
189- } , [ getPoolById . isLoading , getTransactionsByPoolId . isLoading ] )
190-
191- if (
192- isInitialLoad &&
193- ( getPoolById . isLoading || getTransactionsByPoolId . isLoading || getUserStats . isLoading )
194- )
184+ if ( getPoolById . isLoading || getTransactionsByPoolId . isLoading || getUserStats . isLoading )
195185 return (
196186 < div className = "w-full mx-auto 2xl:max-w-7xl lg:max-w-5xl md:max-w-2xl px-[15px]" >
197187 < Button
@@ -216,7 +206,7 @@ export default function PoolDetail({ params }: { params: { poolId: string } }) {
216206 < HiOutlineArrowNarrowLeft />
217207 < h4 > Pools</ h4 >
218208 </ Button >
219- { getPoolById . isLoading ? (
209+ { getPoolById . isRefetching ? (
220210 < div className = "flex flex-wrap items-center justify-between gap-4" >
221211 < div className = "flex items-center gap-2" >
222212 < Skeleton className = "h-7 w-7 rounded-full" />
@@ -340,33 +330,33 @@ export default function PoolDetail({ params }: { params: { poolId: string } }) {
340330 mintBAmount = { mintBAmount }
341331 mintASymbol = { pool ?. mintA ?. symbol ?? '' }
342332 mintBSymbol = { pool ?. mintB ?. symbol ?? '' }
343- isLoading = { getPoolById . isLoading }
333+ isLoading = { getPoolById . isRefetching }
344334 />
345335 </ div >
346336 < div className = "md:mt-6 mt-3 grid grid-cols-2 lg:flex lg:gap-y-0 gap-y-3 items-center justify-between" >
347337 < StatsItem
348- isLoading = { getPoolById . isLoading }
338+ isLoading = { getPoolById . isRefetching }
349339 title = "APR(7 days)"
350340 info = "Weekly Percentage Rate earned by liquidity providers from trading fees and rewards."
351341 content = { `${ pool ?. apr24h . toFixed ( 2 ) ?? 0.0 } %` }
352342 />
353343 < hr className = "w-px h-12 lg:block hidden bg-light-grey border-0" />
354344 < StatsItem
355- isLoading = { getPoolById . isLoading }
345+ isLoading = { getPoolById . isRefetching }
356346 title = "TVL"
357347 info = "The total dollar value of assets locked in this liquidity pool."
358348 content = { `$${ pool ?. tvl . toLocaleString ( ) ?? 0 } ` }
359349 />
360350 < hr className = "w-px h-12 lg:block hidden bg-light-grey border-0" />
361351 < StatsItem
362- isLoading = { getPoolById . isLoading }
352+ isLoading = { getPoolById . isRefetching }
363353 title = "Fees(24h)"
364354 info = "Trading fees generated by this pool in the past 24 hours."
365355 content = { `$${ pool ?. fees24h . toFixed ( 3 ) ?? 0 } ` }
366356 />
367357 < hr className = "w-px h-12 lg:block hidden bg-light-grey border-0" />
368358 < StatsItem
369- isLoading = { getPoolById . isLoading }
359+ isLoading = { getPoolById . isRefetching }
370360 title = "Volume(24h)"
371361 info = "Total swap volume (trades) processed in this pool within the last 24 hours."
372362 content = { `$${ pool ?. volume24h . toFixed ( 3 ) ?? 0 } ` }
@@ -462,33 +452,33 @@ export default function PoolDetail({ params }: { params: { poolId: string } }) {
462452 mintBAmount = { userStats ?. userReserveB ?? 0 }
463453 mintASymbol = { pool ?. mintA ?. symbol ?? '' }
464454 mintBSymbol = { pool ?. mintB ?. symbol ?? '' }
465- isLoading = { getUserStats . isLoading }
455+ isLoading = { getUserStats . isRefetching }
466456 />
467457 </ div >
468458 < div className = "md:mt-6 mt-3 grid grid-cols-2 lg:flex lg:gap-y-0 gap-y-3 items-center justify-between" >
469459 < StatsItem
470- isLoading = { getUserStats . isLoading }
460+ isLoading = { getUserStats . isRefetching }
471461 title = "My Pool Share (%)"
472462 info = "This is the percentage of the total liquidity pool that you currently own."
473463 content = { `${ ( ( userStats ?. userShare ?? 0 ) * 100 ) . toFixed ( 2 ) } %` }
474464 />
475465 < hr className = "w-px h-12 lg:block hidden bg-light-grey border-0" />
476466 < StatsItem
477- isLoading = { getUserStats . isLoading }
467+ isLoading = { getUserStats . isRefetching }
478468 title = "My Liquidity Value"
479469 info = "The estimated dollar value of the tokens you've contributed to this pool."
480470 content = { `$${ userStats ?. userReserveTotalPrice . toLocaleString ( ) ?? 0 } ` }
481471 />
482472 < hr className = "w-px h-12 lg:block hidden bg-light-grey border-0" />
483473 < StatsItem
484- isLoading = { getUserStats . isLoading }
474+ isLoading = { getUserStats . isRefetching }
485475 title = "LP Tokens Held"
486476 info = "The total number of LP (liquidity provider) tokens you own — including both staked and unstaked."
487477 content = { `${ userStats ?. userLPToken . toLocaleString ( ) ?? 0 } LP` }
488478 />
489479 < hr className = "w-px h-12 lg:block hidden bg-light-grey border-0" />
490480 < StatsItem
491- isLoading = { getUserStats . isLoading }
481+ isLoading = { getUserStats . isRefetching }
492482 title = "Fee Earnings(24h)"
493483 info = "Total amount you've earned from trading fees within the last 24 hours."
494484 content = { `$${ userStats ?. dailyFeeEarnings . toFixed ( 3 ) ?? 0 } ` }
@@ -499,7 +489,7 @@ export default function PoolDetail({ params }: { params: { poolId: string } }) {
499489 </ div >
500490 < div className = "flex flex-col md:space-y-6 space-y-3 md:mt-14 mt-5" >
501491 < h2 className = "font-semibold lg:text-2xl text-xl text-main-black" > Transactions</ h2 >
502- { getTransactionsByPoolId . isLoading ? (
492+ { getTransactionsByPoolId . isRefetching ? (
503493 < PoolDetailTransactionSkeleton />
504494 ) : (
505495 < TransactionDataTable
0 commit comments