From cb49d69a3ffb703fda49745481a7386cf75b42b5 Mon Sep 17 00:00:00 2001 From: Gonzalo Aune Date: Thu, 27 Aug 2026 12:56:24 +0100 Subject: [PATCH] changes for localstack --- src/app/layout.tsx | 27 +++++++++++++++++ src/lib/agent-api.ts | 4 +-- src/lib/api.ts | 43 ++++++++++++++++++++++---- src/lib/graph-api.ts | 8 ++--- src/lib/runtime-config.ts | 64 +++++++++++++++++++++++++++++++++++++++ src/lib/socket.ts | 4 +-- 6 files changed, 136 insertions(+), 14 deletions(-) create mode 100644 src/lib/runtime-config.ts diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 333e029b..89c6a4ce 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,8 +1,24 @@ import type { Metadata, Viewport } from "next" import { Rajdhani, Plus_Jakarta_Sans, Fira_Code } from "next/font/google" import { TooltipProvider } from "@/components/ui/tooltip" +import { + RUNTIME_CONFIG_GLOBAL, + readRuntimeConfig, + serializeRuntimeConfig, +} from "@/lib/runtime-config" import "./globals.css" +/** + * Required for runtime configuration to mean anything. + * + * Next prerenders a layout with no dynamic inputs at build time, which would + * evaluate readRuntimeConfig() during `next build` and bake that value into the + * HTML — reintroducing exactly the build-time freezing this replaces. Rendering + * per request is what lets GRAPH_MINDSET_API_URL be read from the live + * environment on every boot. + */ +export const dynamic = "force-dynamic" + const rajdhani = Rajdhani({ variable: "--font-heading", subsets: ["latin"], @@ -51,6 +67,17 @@ export default function RootLayout({ className={`${rajdhani.variable} ${jakarta.variable} ${firaCode.variable} h-full antialiased dark`} > + {/* + Inline and first in the document so it runs during parse, before the + deferred application bundles — getApiUrl() therefore always sees it. + */} +