Skip to content

Commit 85eb465

Browse files
authored
docs: add note about not using validateRequest() in layout.tsx on app… (#1698)
1 parent fb23b4d commit 85eb465

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/pages/tutorials/github-oauth/nextjs-app.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export const validateRequest = cache(
248248
);
249249
```
250250

251-
This function can then be used in server components and form actions to get the current session and user.
251+
This function can then be used in server components and form actions to get the current session and user.
252252

253253
```tsx
254254
import { redirect } from "next/navigation";
@@ -263,6 +263,8 @@ export default async function Page() {
263263
}
264264
```
265265

266+
> Note: This code is not suitable for use in `layout.tsx` files. Layouts do not re-render on page transitions, so the authentication check won't run for each route change.
267+
266268
## Sign out
267269

268270
Sign out users by invalidating their session with `Lucia.invalidateSession()`. Make sure to remove their session cookie by setting a blank session cookie created with `Lucia.createBlankSessionCookie()`.

docs/pages/tutorials/username-and-password/nextjs-app.md

+2
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ export default async function Page() {
317317
}
318318
```
319319

320+
> Note: This code is not suitable for use in `layout.tsx` files. Layouts do not re-render on page transitions, so the authentication check won't run for each route change.
321+
320322
## Sign out
321323

322324
Sign out users by invalidating their session with `Lucia.invalidateSession()`. Make sure to remove their session cookie by setting a blank session cookie created with `Lucia.createBlankSessionCookie()`.

0 commit comments

Comments
 (0)