@@ -135,34 +135,36 @@ export function CloudEnvironmentConnectRows({
135135 return < RemoteEnvironmentRowsSkeleton /> ;
136136 }
137137
138+ // A failed or offline discovery is not "no environments" — misreporting it
139+ // as empty would read as the user's devices having disappeared. The card is
140+ // also rendered alongside any already-discovered rows, so a failed refresh
141+ // never hides behind an otherwise-healthy list.
142+ const discoveryProblem = environmentsState . offline
143+ ? "You appear to be offline."
144+ : ( Option . getOrNull ( environmentsState . error ) ?. message ?? null ) ;
145+ const discoveryFailure =
146+ discoveryProblem !== null && ! environmentsState . refreshing ? (
147+ < div className = { ITEM_ROW_CLASSNAME } >
148+ < p className = "text-sm font-medium text-destructive" >
149+ Could not load T3 Connect environments
150+ </ p >
151+ < p className = "mt-1 text-xs text-muted-foreground" > { discoveryProblem } </ p >
152+ < Button
153+ size = "sm"
154+ variant = "outline"
155+ className = "mt-3"
156+ onClick = { ( ) => void refreshRelayEnvironments ( ) }
157+ >
158+ Try again
159+ </ Button >
160+ </ div >
161+ ) : null ;
162+
138163 if ( standalone && visibleEnvironments . length === 0 ) {
139- // A failed or offline discovery is not "no environments" — misreporting it
140- // as empty would read as the user's devices having disappeared.
141- const discoveryProblem = environmentsState . offline
142- ? "You appear to be offline."
143- : ( Option . getOrNull ( environmentsState . error ) ?. message ?? null ) ;
144- if ( discoveryProblem !== null && ! environmentsState . refreshing ) {
145- return (
146- < div className = { ITEM_ROW_CLASSNAME } >
147- < p className = "text-sm font-medium text-destructive" >
148- Could not load T3 Connect environments
149- </ p >
150- < p className = "mt-1 text-xs text-muted-foreground" > { discoveryProblem } </ p >
151- < Button
152- size = "sm"
153- variant = "outline"
154- className = "mt-3"
155- onClick = { ( ) => void refreshRelayEnvironments ( ) }
156- >
157- Try again
158- </ Button >
159- </ div >
160- ) ;
161- }
162- return empty ;
164+ return discoveryFailure ?? empty ;
163165 }
164166
165- return visibleEnvironments . map ( ( { environment, availability, error } ) => {
167+ const rows = visibleEnvironments . map ( ( { environment, availability, error } ) => {
166168 const alreadyConnected = savedIds . has ( environment . environmentId ) ;
167169 return (
168170 < div key = { environment . environmentId } className = { ITEM_ROW_CLASSNAME } >
@@ -224,4 +226,11 @@ export function CloudEnvironmentConnectRows({
224226 </ div >
225227 ) ;
226228 } ) ;
229+
230+ return (
231+ < >
232+ { rows }
233+ { discoveryFailure }
234+ </ >
235+ ) ;
227236}
0 commit comments