@@ -73,25 +73,6 @@ function DealsRoute() {
7373 error,
7474 } = useDealData ( ( dealId as string ) . toLowerCase ( ) , chainId ! ) ;
7575
76- const [ isLoadingChild , setIsLoadingChild ] = useState ( false ) ;
77- const [ isOutdatedChild , setIsOutdatedChild ] = useState ( false ) ;
78-
79- const dealDetails = deal
80- ? buildDealDetails ( {
81- deal,
82- isConnected,
83- onSeeTasks : ( ) => setCurrentTab ( 1 ) ,
84- } )
85- : undefined ;
86-
87- if ( ! isValid ) {
88- return < ErrorAlert className = "my-16" message = "Invalid deal address." /> ;
89- }
90-
91- if ( isError && error instanceof NotFoundError ) {
92- return < ErrorAlert className = "my-16" message = "Deal not found." /> ;
93- }
94-
9576 const associatedDealsPresenceQueryKey = [
9677 chainId ,
9778 'deal' ,
@@ -100,7 +81,7 @@ function DealsRoute() {
10081 ] ;
10182 const { data : associatedDealsPresence } = useQuery ( {
10283 queryKey : associatedDealsPresenceQueryKey ,
103- enabled : dealId && ! ! chainId && ! ! deal && currentTab !== 2 ,
84+ enabled : ! ! dealId && ! ! chainId && ! ! deal && currentTab !== 2 ,
10485 queryFn : ( ) =>
10586 execute ( dealAssociatedDealsQuery , chainId ! , {
10687 length : 1 ,
@@ -114,6 +95,25 @@ function DealsRoute() {
11495 const hasAssociatedDeals =
11596 ( associatedDealsPresence ?. deal ?. requestorder ?. deals ?. length || 0 ) > 0 ;
11697
98+ const [ isLoadingChild , setIsLoadingChild ] = useState ( false ) ;
99+ const [ isOutdatedChild , setIsOutdatedChild ] = useState ( false ) ;
100+
101+ const dealDetails = deal
102+ ? buildDealDetails ( {
103+ deal,
104+ isConnected,
105+ onSeeTasks : ( ) => setCurrentTab ( 1 ) ,
106+ } )
107+ : undefined ;
108+
109+ if ( ! isValid ) {
110+ return < ErrorAlert className = "my-16" message = "Invalid deal address." /> ;
111+ }
112+
113+ if ( isError && error instanceof NotFoundError ) {
114+ return < ErrorAlert className = "my-16" message = "Deal not found." /> ;
115+ }
116+
117117 const showOutdated = deal && ( isError || isOutdatedChild ) ;
118118 const showLoading = isLoading || isRefetching || isLoadingChild ;
119119
0 commit comments