From ac0735381f4d868a402c1f3ce006d037dd5bc767 Mon Sep 17 00:00:00 2001 From: "Carlos (Almeira)" Date: Sat, 28 Mar 2026 12:14:28 -0500 Subject: [PATCH] fix: global serialization hardening for layouts and components - Sanitized getEntityConfig at the source to prevent Navbar errors. - Sanitized user object in DashboardLayout to protect Sidebar. - This ensures all collections and custom routes are immune to 'Only plain objects' errors. --- src/app/actions/entity.ts | 2 +- src/app/dashboard/layout.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/actions/entity.ts b/src/app/actions/entity.ts index 8d388e1..0a9f363 100644 --- a/src/app/actions/entity.ts +++ b/src/app/actions/entity.ts @@ -25,7 +25,7 @@ export async function getEntityConfig() { COLLECTION_ID, [Query.limit(1)] ); - return response.documents[0] || null; + return response.documents[0] ? JSON.parse(JSON.stringify(response.documents[0])) : null; } catch (error: any) { // Silently handle 404 (collection not found) if (error?.code === 404) { diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx index 3574ad8..feff0c7 100644 --- a/src/app/dashboard/layout.tsx +++ b/src/app/dashboard/layout.tsx @@ -9,7 +9,7 @@ export default async function DashboardLayout({ }: { children: React.ReactNode; }) { - const user = await getLoggedInUser(); + const user = JSON.parse(JSON.stringify(await getLoggedInUser())); if (!user) { redirect('/login'); }