Next.js 15 中 cookies().set() 后跟 redirect() 不兼容,因为 redirect() 抛出特殊错误终止请求,不会包含之前设置的 cookie。解决:用 Server Action(cookies().set 在 Action 中正常工作)或渲染客户端组件处理。 Prisma 索引没生效查询慢,确认:① 查询条件字段是否建了 @@index ② 迁移是否执行 ③ 用 EXPLAIN ANALYZE 查看执行计划 ④ 是否有函数索引需求 ⑤ 大表考虑分区。 React Server Component 中使用 useState 报错,因为 Server Component 不能用 hooks。解决:① 把需要状态的组件拆成 Client Component(加 'use client') ② 父组件保持 Server Component 做数据获取,子组件 Client 做交互。