迷路
迷路的信鸽楼主
Auth.js 5 signIn redirect:false 返回 { error, ok, status, url }。判断成功:!result.error && result.ok。注意 result.url 可能含 ?error= 参数,用 redirectTo 显式指定避免误判。
React Server Component 中使用 useState 报错,因为 Server Component 不能用 hooks。解决:① 把需要状态的组件拆成 Client Component(加 'use client') ② 父组件保持 Server Component 做数据获取,子组件 Client 做交互。
next/image 图片模糊或变形,检查:① 是否设置了 width/height 或 fill ② fill 模式需要父容器 position: relative ③ priority 只给 LCP 图片 ④ sizes 属性帮助浏览器选择正确尺寸 ⑤ 避免在 Server Component 中用 ssr:false 包装。