@@ -11,7 +11,6 @@ import * as Layer from "effect/Layer";
1111import * as Option from "effect/Option" ;
1212import { AsyncResult , Atom } from "effect/reactivity" ;
1313import { HttpClient } from "effect/http" ;
14- import { useCallback , useMemo } from "react" ;
1514
1615import { usePrimaryEnvironment } from "../state/environments" ;
1716import { runtime } from "../lib/runtime" ;
@@ -67,26 +66,23 @@ export function readCachedPrimaryCloudLinkState(target: CloudLinkTarget) {
6766export function usePrimaryCloudLinkState ( ) {
6867 const primary = usePrimaryEnvironment ( ) ;
6968 const canReadRelay = useEnvironmentScope ( primary ?. environmentId ?? null , AuthRelayReadScope ) ;
70- const target = useMemo (
71- ( ) =>
72- primary ?. entry . target . _tag === "PrimaryConnectionTarget"
73- ? {
74- environmentId : primary . environmentId ,
75- label : primary . label ,
76- httpBaseUrl : primary . entry . target . httpBaseUrl ,
77- wsBaseUrl : primary . entry . target . wsBaseUrl ,
78- }
79- : null ,
80- [ primary ] ,
81- ) ;
69+ const target =
70+ primary ?. entry . target . _tag === "PrimaryConnectionTarget"
71+ ? {
72+ environmentId : primary . environmentId ,
73+ label : primary . label ,
74+ httpBaseUrl : primary . entry . target . httpBaseUrl ,
75+ wsBaseUrl : primary . entry . target . wsBaseUrl ,
76+ }
77+ : null ;
8278 const atom =
8379 target && hasCloudPublicConfig ( ) && canReadRelay
8480 ? primaryCloudLinkStateAtom ( targetKey ( target ) )
8581 : EMPTY_PRIMARY_CLOUD_LINK_STATE_ATOM ;
8682 const result = useAtomValue ( atom ) ;
87- const refresh = useCallback ( ( ) => {
83+ const refresh = ( ) => {
8884 refreshPrimaryCloudLinkState ( target ) ;
89- } , [ target ] ) ;
85+ } ;
9086 let error : string | null = null ;
9187 if ( result . _tag === "Failure" ) {
9288 const cause = Cause . squash ( result . cause ) ;
0 commit comments