The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 06:45 UTC
perf(web): the primary cloud link hook compiles without manual memoization (#20554)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 22:08 UTC
65ebf8f86e33a1f65edfb371b7d5bcc0d96a0f3f
1 file changed
+11
-15
apps/web/src/cloud/primaryCloudLinkState.ts
+11
-15
@@ -11,7 +11,6 @@ import * as Layer from "effect/Layer";
11
import * as Option from "effect/Option";
12
import { AsyncResult, Atom } from "effect/reactivity";
13
import { HttpClient } from "effect/http";
14
-import { useCallback, useMemo } from "react";
14
15
import { usePrimaryEnvironment } from "../state/environments";
16
import { runtime } from "../lib/runtime";
@@ -67,26 +66,23 @@ export function readCachedPrimaryCloudLinkState(target: CloudLinkTarget) {
66
export function usePrimaryCloudLinkState() {
67
const primary = usePrimaryEnvironment();
68
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;
78
const atom =
79
target && hasCloudPublicConfig() && canReadRelay
80
? primaryCloudLinkStateAtom(targetKey(target))
81
: EMPTY_PRIMARY_CLOUD_LINK_STATE_ATOM;
82
const result = useAtomValue(atom);
87
- const refresh = useCallback(() => {
83
+ const refresh = () => {
84
refreshPrimaryCloudLinkState(target);
89
- }, [target]);
85
+ };
86
let error: string | null = null;
87
if (result._tag === "Failure") {
88
const cause = Cause.squash(result.cause);