老张
老张楼主
Prisma Json 字段查询,用 prismaToJson 过滤或 $queryRaw 用 PostgreSQL 的 ->> 操作符。Prisma 6 支持直接在 where 中用 path 过滤 Json 字段。 Zod refine 校验不触发,检查:① refine 是否在 schema 末尾 ② 是否用了 safeParse(parse 会抛错) ③ refine 的 path 是否正确指向字段 ④ 异步 refine 用 superRefine + async。 middleware 重定向循环,一般是认证逻辑和业务重定向冲突。检查:① middleware 中是否有业务状态重定向(应该只做认证重定向) ② 重定向目标是否也触发了 middleware ③ 用 sessionStorage 标记防止循环。 toast 和 router.push 冲突,因为 toast 的状态更新会中断 router.push 的 startTransition。解决:用 window.location.href 硬导航,或先 toast 再 setTimeout(() => router.push, 0)。