Skip to content

Commit 6f68d6d

Browse files
perf(web): the primary session state hook compiles without manual memoization (pingdotgg#20581)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 6b563bb commit 6f68d6d

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎apps/web/src/environments/primary/sessionState.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as Cause from "effect/Cause";
33
import * as Effect from "effect/Effect";
44
import * as Option from "effect/Option";
55
import { AsyncResult, Atom } from "effect/reactivity";
6-
import { useCallback } from "react";
76

87
import { isLocalEnvironmentDisabled } from "../../localEnvironment";
98
import { appAtomRegistry } from "../../rpc/atomRegistry";
@@ -25,9 +24,6 @@ function refreshPrimarySessionState(): void {
2524

2625
export function usePrimarySessionState() {
2726
const result = useAtomValue(primarySessionStateAtom);
28-
const refresh = useCallback(() => {
29-
refreshPrimarySessionState();
30-
}, []);
3127
let error: string | null = null;
3228
if (result._tag === "Failure") {
3329
const cause = Cause.squash(result.cause);
@@ -37,6 +33,6 @@ export function usePrimarySessionState() {
3733
data: Option.getOrNull(AsyncResult.value(result)),
3834
error,
3935
isPending: result.waiting,
40-
refresh,
36+
refresh: refreshPrimarySessionState,
4137
};
4238
}

0 commit comments

Comments
 (0)