@@ -3,6 +3,7 @@ import { execute } from '@/graphql/poco/execute';
33import { useQuery } from '@tanstack/react-query' ;
44import { createFileRoute } from '@tanstack/react-router' ;
55import { LoaderCircle } from 'lucide-react' ;
6+ import { useState } from 'react' ;
67import WorkerpoolIcon from '@/components/icons/WorkerpoolIcon' ;
78import { BackButton } from '@/components/ui/BackButton' ;
89import { useTabParam } from '@/hooks/usePageParam' ;
@@ -77,6 +78,9 @@ function WorkerpoolsRoute() {
7778 error,
7879 } = useWorkerpoolData ( ( workerpoolAddress as string ) . toLowerCase ( ) , chainId ! ) ;
7980
81+ const [ isLoadingChild , setIsLoadingChild ] = useState ( false ) ;
82+ const [ isOutdatedChild , setIsOutdatedChild ] = useState ( false ) ;
83+
8084 const workerpoolDetails = workerpool
8185 ? buildWorkerpoolDetails ( { workerpool } )
8286 : undefined ;
@@ -91,6 +95,9 @@ function WorkerpoolsRoute() {
9195 return < ErrorAlert className = "my-16" message = "Workerpool not found." /> ;
9296 }
9397
98+ const showOutdated = workerpool && ( isError || isOutdatedChild ) ;
99+ const showLoading = isLoading || isRefetching || isLoadingChild ;
100+
94101 return (
95102 < div className = "mt-8 flex flex-col gap-6" >
96103 < div className = "mt-6 flex flex-col justify-between lg:flex-row" >
@@ -99,14 +106,12 @@ function WorkerpoolsRoute() {
99106 < h1 className = "flex items-center gap-2 text-2xl font-extrabold" >
100107 < WorkerpoolIcon size = { 24 } />
101108 Workerpool details
102- { workerpool && isError && (
109+ { showOutdated && (
103110 < span className = "text-muted-foreground text-sm font-light" >
104111 (outdated)
105112 </ span >
106113 ) }
107- { ( isLoading || isRefetching ) && (
108- < LoaderCircle className = "animate-spin" />
109- ) }
114+ { showLoading && < LoaderCircle className = "animate-spin" /> }
110115 </ h1 >
111116 < div className = "flex items-center gap-2" >
112117 < BackButton />
@@ -127,7 +132,11 @@ function WorkerpoolsRoute() {
127132 < DetailsTable details = { workerpoolDetails || { } } zebra = { false } />
128133 ) ) }
129134 { currentTab === 1 && (
130- < WorkerpoolDealsTable workerpoolAddress = { workerpoolAddress } />
135+ < WorkerpoolDealsTable
136+ workerpoolAddress = { workerpoolAddress }
137+ setLoading = { setIsLoadingChild }
138+ setOutdated = { setIsOutdatedChild }
139+ />
131140 ) }
132141 </ div >
133142 ) ;
0 commit comments