From 0bde11b86e402311c2ea838416f77ea17516ede0 Mon Sep 17 00:00:00 2001
From: dmitriylaukhin
Date: Sat, 25 Apr 2026 13:42:05 +0500
Subject: [PATCH] Serialize all Prisma data before passing to Client Components
Prisma 7 proxy objects (DateTime, _count, relations) cannot be
serialized by React RSC. Convert all course page data to plain
JSON objects with JSON.parse/stringify before passing as props.
Co-Authored-By: Claude Sonnet 4.6
---
src/app/admin/courses/[courseId]/page.tsx | 26 +++++++++++++++--------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/app/admin/courses/[courseId]/page.tsx b/src/app/admin/courses/[courseId]/page.tsx
index a49474b..977eb50 100644
--- a/src/app/admin/courses/[courseId]/page.tsx
+++ b/src/app/admin/courses/[courseId]/page.tsx
@@ -50,13 +50,21 @@ export default async function CourseDetailPage({ params }: Props) {
if (!course) notFound();
+ // Prisma 7 returns proxy objects for relations/aggregates that RSC cannot serialize.
+ // Convert to plain JS before passing to Client Components.
+ const plain = JSON.parse(JSON.stringify({ course, allStudents, categories })) as {
+ course: typeof course;
+ allStudents: typeof allStudents;
+ categories: typeof categories;
+ };
+
return (
{/* Breadcrumb */}
{/* Course metadata */}
@@ -64,7 +72,7 @@ export default async function CourseDetailPage({ params }: Props) {
Основная информация
-
+
{/* Modules */}
@@ -74,19 +82,19 @@ export default async function CourseDetailPage({ params }: Props) {
Модули
- {course.modules.length} модулей
+ {plain.course.modules.length} модулей
-
+
{/* Course tree overview */}
- {course.modules.length > 0 && (
+ {plain.course.modules.length > 0 && (
)}
@@ -97,9 +105,9 @@ export default async function CourseDetailPage({ params }: Props) {