@@ -10,6 +10,7 @@ import {
1010 createEnvironmentRpcCommand ,
1111 createEnvironmentRpcSubscriptionAtomFamily ,
1212} from "@t3tools/client-runtime/state/runtime" ;
13+ import { isAnswerExpected } from "@t3tools/client-runtime/connection" ;
1314import * as Option from "effect/Option" ;
1415import { AsyncResult , Atom } from "effect/unstable/reactivity" ;
1516
@@ -47,18 +48,19 @@ export const runAutomationNow = createEnvironmentRpcCommand(connectionAtomRuntim
4748
4849interface AutomationsView {
4950 readonly automations : readonly EnvironmentAutomation [ ] ;
50- /** True until every environment has answered at least once . */
51+ /** True while a reachable environment has not answered yet . */
5152 readonly isPending : boolean ;
5253}
5354
5455const allAutomationsAtom = Atom . make ( ( get ) : AutomationsView => {
5556 const automations : EnvironmentAutomation [ ] = [ ] ;
5657 let isPending = false ;
57- for ( const environmentId of get ( environmentPresentations . presentationsAtom ) . keys ( ) ) {
58+ for ( const [ environmentId , presentation ] of get ( environmentPresentations . presentationsAtom ) ) {
5859 const result = get ( automationsByEnvironment ( { environmentId, input : { } } ) ) ;
5960 const snapshot = Option . getOrNull ( AsyncResult . value ( result ) ) ;
6061 if ( snapshot === null ) {
61- isPending ||= result . _tag !== "Failure" ;
62+ // An unreachable environment never answers; it must not hold the whole list in loading.
63+ isPending ||= result . _tag !== "Failure" && isAnswerExpected ( presentation ) ;
6264 continue ;
6365 }
6466 for ( const automation of snapshot . automations ) {
0 commit comments