Fix Prisma 7 JSON proxy serialization in RSC props
Prisma 7 wraps Json fields in proxy objects that RSC cannot serialize. Fix: select specific columns (exclude content) in module page, and JSON.parse/stringify lesson content before passing to client. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -55,7 +55,7 @@ export default async function LessonEditorPage({ params }: Props) {
|
|||||||
id: lesson.id,
|
id: lesson.id,
|
||||||
title: lesson.title,
|
title: lesson.title,
|
||||||
kinescopeId: lesson.kinescopeId ?? "",
|
kinescopeId: lesson.kinescopeId ?? "",
|
||||||
content: (lesson.content as object) ?? {},
|
content: JSON.parse(JSON.stringify(lesson.content ?? {})),
|
||||||
published: lesson.published,
|
published: lesson.published,
|
||||||
}}
|
}}
|
||||||
courseId={courseId}
|
courseId={courseId}
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ export default async function ModulePage({ params }: Props) {
|
|||||||
where: { id: moduleId },
|
where: { id: moduleId },
|
||||||
include: {
|
include: {
|
||||||
course: { select: { title: true } },
|
course: { select: { title: true } },
|
||||||
lessons: { orderBy: { order: "asc" } },
|
lessons: {
|
||||||
|
orderBy: { order: "asc" },
|
||||||
|
select: { id: true, title: true, order: true, published: true, kinescopeId: true },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
prisma.module.findMany({
|
prisma.module.findMany({
|
||||||
|
|||||||
Reference in New Issue
Block a user