@@ -3,7 +3,6 @@ import * as Cause from "effect/Cause";
33import * as Effect from "effect/Effect" ;
44import * as Exit from "effect/Exit" ;
55import * as Option from "effect/Option" ;
6- import * as Schema from "effect/Schema" ;
76import * as Stream from "effect/Stream" ;
87import * as SubscriptionRef from "effect/SubscriptionRef" ;
98import { AsyncResult , Atom , AtomRegistry } from "effect/unstable/reactivity" ;
@@ -22,7 +21,13 @@ import {
2221} from "../rpc/client.ts" ;
2322import { EnvironmentSupervisor } from "../connection/supervisor.ts" ;
2423
25- const isEnvironmentRpcUnavailableError = Schema . is ( EnvironmentRpcUnavailableError ) ;
24+ // `catchTags` preserves unmatched errors at runtime; this signature keeps that
25+ // generic remainder while removing the one known connection-handoff error.
26+ const waitForEnvironmentConnectionSignal = Effect . catchTags ( {
27+ EnvironmentRpcUnavailableError : ( ) => Effect . never ,
28+ } ) as < A , E , R > (
29+ effect : Effect . Effect < A , E | EnvironmentRpcUnavailableError , R > ,
30+ ) => Effect . Effect < A , E , R > ;
2631
2732interface EnvironmentAtomOptions < Input , A , E , R > {
2833 readonly label : string ;
@@ -550,7 +555,7 @@ export function createEnvironmentQueryAtomFamily<R, ER, Input, A, E>(
550555 // first, keep it pending until the signal selects the
551556 // reconnecting or terminal branch instead of flashing a
552557 // transient unavailable failure.
553- Effect . catchIf ( isEnvironmentRpcUnavailableError , ( ) => Effect . never ) ,
558+ waitForEnvironmentConnectionSignal ,
554559 )
555560 : Effect . never ;
556561 case "connecting" :
0 commit comments