Skip to content

Commit fce6644

Browse files
committed
Fix double fetching
1 parent 51ea4bc commit fce6644

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

client/src/components/OAuthCallback.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
import { useEffect } from 'react';
1+
import { useEffect, useRef } from 'react';
22
import { handleOAuthCallback } from '../lib/auth';
33
import { SESSION_KEYS } from '../lib/constants';
44

55
const OAuthCallback = () => {
6+
const hasProcessedRef = useRef(false);
7+
68
useEffect(() => {
79
const handleCallback = async () => {
10+
// Skip if we've already processed this callback
11+
if (hasProcessedRef.current) {
12+
return;
13+
}
14+
hasProcessedRef.current = true;
15+
816
const params = new URLSearchParams(window.location.search);
917
const code = params.get('code');
1018
const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL);

0 commit comments

Comments
 (0)