山间
山间清风楼主
Prisma 多对多关系创建,用 connect 或 create 连接:prisma.user.create({ data: { roles: { connect: [{ id: roleId }] } } })。隐式多对多表 Prisma 自动管理,显式多对多需要自己管理中间表。
Server Action 提交后不跳转,可能是用了 router.push 而非 window.location.href。Next.js 15 + next-intl 的 router.push 在 startTransition 内会被 toast 的状态更新中断。解决:用 window.location.href 硬导航。
Shadcn UI 组件在 Server Component 报错,因为部分组件用了 Radix UI(Client Component)。确保使用 Shadcn 组件的页面或父组件加了 'use client',或者把组件包裹在 Client Component wrapper 中。
Auth.js 5 beta 的 session 丢失问题,常见原因:① AUTH_SECRET 未配置或变了 ② cookie 被中间件清除 ③ JWT 过期。排查:检查 AUTH_SECRET 是否一致,middleware 中是否有不必要的 Set-Cookie,callbacks.jwt 是否正确返回 token。