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.
This commit is contained in:
Carlos (Almeira) 2026-03-28 12:14:28 -05:00
parent b58a2a59fb
commit ac0735381f
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

View File

@ -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');
}