Skip to content

Commit af04d30

Browse files
authored
fix: memoized frontend session retrieval (#454)
1 parent e14a2af commit af04d30

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

frontend/src/utils/auth.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { redirect } from 'next/navigation';
33
import { authOptions } from 'app/api/auth/[...nextauth]/config';
44
import { memoizePromise } from '@/utils/async';
55

6-
const internalGetAuthSession = async (): Promise<Session | null> => {
7-
const memoizedFrontend = memoizePromise(
8-
() => import('next-auth/react').then((m) => m.getSession()),
9-
50,
10-
);
6+
const memoizedFrontend = memoizePromise(
7+
() => import('next-auth/react').then((m) => m.getSession()),
8+
500,
9+
);
1110

11+
const internalGetAuthSession = async (): Promise<Session | null> => {
1212
const internalSession = await (typeof window === 'undefined'
1313
? import('next-auth').then((m) => m.getServerSession(authOptions))
1414
: memoizedFrontend());

0 commit comments

Comments
 (0)