From 7d4586228ae6003954962eb73990d18c81a94f4c Mon Sep 17 00:00:00 2001 From: YKaizer <163474883+YKaizer@users.noreply.github.com> Date: Wed, 2 Jul 2025 15:53:44 +0400 Subject: [PATCH] Fix: resolve TypeError in layout.tsx due to async headers Fixes a TypeScript error where layout.tsx was trying to access `.get()` on a Promise. Added await (or equivalent fix) to properly resolve the headers before accessing cookies. --- modal-login/app/layout.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modal-login/app/layout.tsx b/modal-login/app/layout.tsx index 6a2d0634..da3ab17a 100644 --- a/modal-login/app/layout.tsx +++ b/modal-login/app/layout.tsx @@ -13,16 +13,17 @@ export const metadata: Metadata = { description: "Modal sign in for Gensyn Testnet", }; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { - // Persist state across pages - // https://accountkit.alchemy.com/react/ssr#persisting-the-account-state + // Wait a headers + const headerData = await headers(); + const initialState = cookieToInitialState( config, - headers().get("cookie") ?? undefined, + headerData.get("cookie") ?? undefined, ); return (