Skip to content

Commit 3f48ff5

Browse files
chore: remove dead stateRef from useManagedAuthSession
Drop the unused state ref + sync useEffect, plus two narrative comments that just restated the next line of code. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent acebe14 commit 3f48ff5

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

packages/managed-auth-react/src/session/useManagedAuthSession.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,11 @@ export function useManagedAuthSession(
8282

8383
const pollRef = useRef<ReturnType<typeof setInterval> | null>(null);
8484
const pollDelayRef = useRef<ReturnType<typeof setTimeout> | null>(null);
85-
const stateRef = useRef<ManagedAuthResponse | null>(null);
8685
const callbackFiredRef = useRef<{ success: boolean; error: boolean }>({
8786
success: false,
8887
error: false,
8988
});
9089

91-
// Keep a ref of the latest state for onSuccess / onError callbacks.
92-
useEffect(() => {
93-
stateRef.current = state;
94-
}, [state]);
95-
9690
const stopPolling = useCallback(() => {
9791
if (pollDelayRef.current) {
9892
clearTimeout(pollDelayRef.current);
@@ -172,7 +166,6 @@ export function useManagedAuthSession(
172166
[pollOnce],
173167
);
174168

175-
// Exchange handoff code on mount.
176169
useEffect(() => {
177170
let cancelled = false;
178171
(async () => {
@@ -184,7 +177,6 @@ export function useManagedAuthSession(
184177
);
185178
if (cancelled) return;
186179
setJwt(token);
187-
// Fetch initial state + derive UI
188180
const initial = await retrieveManagedAuth(sessionId, token, options);
189181
if (cancelled) return;
190182
setState(initial);

0 commit comments

Comments
 (0)