躺平
躺平选手楼主
next/image 图片模糊或变形,检查:① 是否设置了 width/height 或 fill ② fill 模式需要父容器 position: relative ③ priority 只给 LCP 图片 ④ sizes 属性帮助浏览器选择正确尺寸 ⑤ 避免在 Server Component 中用 ssr:false 包装。 Auth.js JWT token 中字段不更新,因为 JWT 是有状态的快照。修改用户字段后需要用 useSession().update() 刷新客户端 session,同时 JWT callback 中处理 trigger === 'update' 从 DB 读取最新值更新 token。 next-intl 配置后 404,一般是 middleware 匹配规则不对。检查 middleware.ts 中 matcher 配置,确保排除了 /api、/_next、/admin 等非国际化路径。另外检查 defaultLocale 和 locales 配置是否正确。 Auth.js credentials 登录返回 null,检查:① authorize 函数是否正确返回 user 对象 ② 密码 bcrypt.compare 是否正确 ③ 用户状态是否 active ④ 是否触发了限流 ⑤ email 是否小写化匹配。 Server Action 提交后不跳转,可能是用了 router.push 而非 window.location.href。Next.js 15 + next-intl 的 router.push 在 startTransition 内会被 toast 的状态更新中断。解决:用 window.location.href 硬导航。