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:
parent
b58a2a59fb
commit
ac0735381f
@ -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) {
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user