Skip to content

Commit 1fffb49

Browse files
committed
fix(next/server): custom auth may yield stale server session
1 parent a6bcf69 commit 1fffb49

14 files changed

Lines changed: 2915 additions & 967 deletions

File tree

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "node-terminal",
77
"request": "launch",
88
"command": "npm run dev",
9-
"cwd": "${workspaceFolder}/examples/basic-nextjs-15"
9+
"cwd": "${workspaceFolder}/examples/nextjs-15-basic"
1010
},
1111
{
1212
"name": "Next.js: debug client-side",

examples/nextjs-15-basic/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/nextjs-15-basic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"@rownd/next": "file:../../packages/next/rownd-next-2.6.0.tgz",
12+
"@rownd/next": "2.7.4",
1313
"next": "15.0.4",
1414
"react": "^19.0.0",
1515
"react-dom": "^19.0.0"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import Fallback from '@/components/Fallback';
2+
import { getRowndUser } from '@rownd/next/server';
3+
import { RowndServerStateSync, withRowndRequireSignIn } from '@rownd/next';
4+
import { cookies } from 'next/headers';
5+
6+
async function CustomPage() {
7+
const data = await fetch('https://jsonplaceholder.typicode.com/posts');
8+
const posts: { id: number; title: string; body: string }[] = await data.json();
9+
const user = await getRowndUser(cookies);
10+
11+
return (
12+
<>
13+
<div className="flex justify-center flex-col w-50 ">
14+
<h1 className="text-2xl font-bold">Custom page</h1>
15+
<h3>User ID: {JSON.stringify(user, null, 2)}</h3>
16+
<Fallback />
17+
<ul className="flex flex-col list-disc">
18+
{posts
19+
.filter((_, idx) => idx < 5)
20+
.map((post) => (
21+
<li className="flex flex-col p-2" key={post.id}>
22+
<h2>{post.title}</h2>
23+
<p>{post.body}</p>
24+
</li>
25+
))}
26+
</ul>
27+
</div>
28+
<RowndServerStateSync />
29+
</>
30+
);
31+
}
32+
33+
export default CustomPage;

0 commit comments

Comments
 (0)