({
children,
}: {
children: React.ReactNode;
})
| 32 | }; |
| 33 | |
| 34 | export default function RootLayout({ |
| 35 | children, |
| 36 | }: { |
| 37 | children: React.ReactNode; |
| 38 | }) { |
| 39 | // FrameworkProvider needs the set of known framework slugs so it can |
| 40 | // detect URL-scoped framework views. The framework *selector* now |
| 41 | // lives inside the docs sidebar, not in the top bar, so its own |
| 42 | // options are wired up in the docs page-level server components. |
| 43 | // |
| 44 | // Guard against registry slugs that would collide with top-level |
| 45 | // route segments under src/app/ (see RESERVED_ROUTE_SLUGS). Without |
| 46 | // this filter, a registry entry named e.g. "reference" would cause |
| 47 | // FrameworkProvider.urlFramework to treat /reference as a framework |
| 48 | // scope rather than the reference docs route. |
| 49 | const reserved = new Set<string>(RESERVED_ROUTE_SLUGS); |
| 50 | const knownFrameworks = getIntegrations() |
| 51 | .map((i) => i.slug) |
| 52 | .filter((slug) => { |
| 53 | if (reserved.has(slug)) { |
| 54 | // Always log — a registry integration slug colliding with a |
| 55 | // reserved top-level route is a hard wiring bug that production |
| 56 | // operators need to see in logs, not a dev-only warning. |
| 57 | // eslint-disable-next-line no-console |
| 58 | console.error( |
| 59 | `[layout] integration slug "${slug}" collides with a reserved top-level route and was dropped from knownFrameworks. Rename the integration slug or update RESERVED_ROUTE_SLUGS.`, |
| 60 | ); |
| 61 | return false; |
| 62 | } |
| 63 | return true; |
| 64 | }); |
| 65 | |
| 66 | // Distinguish "unset" from "empty" for the commit-SHA overlay. |
| 67 | // Docker ARG scope bugs can surface as an empty string rather than |
| 68 | // undefined; showing "dev" in that case is misleading. See the |
| 69 | // Dockerfile fix for the root cause. |
| 70 | const rawSha = process.env.NEXT_PUBLIC_COMMIT_SHA; |
| 71 | const commitLabel = |
| 72 | rawSha === undefined |
| 73 | ? "dev" |
| 74 | : rawSha === "" |
| 75 | ? "unknown" |
| 76 | : rawSha.slice(0, 7); |
| 77 | |
| 78 | // Server-side: read live env at request time. `unstable_noStore()` |
| 79 | // inside getRuntimeConfig opts this segment out of the static |
| 80 | // cache so the inline <script> below always reflects the current |
| 81 | // Railway env vars. |
| 82 | const runtimeConfig = getRuntimeConfig(); |
| 83 | const injection = `window.__SHOWCASE_CONFIG__=${serializeRuntimeConfig(runtimeConfig)};`; |
| 84 | const REO_KEY = runtimeConfig.reoKey; |
| 85 | const REB2B_KEY = runtimeConfig.reb2bKey; |
| 86 | |
| 87 | return ( |
| 88 | // suppressHydrationWarning is required because the inline theme-init |
| 89 | // script below adds/removes `class="dark"` on <html> before React |
| 90 | // hydrates. Without this, Next.js detects the className mismatch and |
| 91 | // reverts the client tree to match the server (which doesn't know the |
nothing calls this directly
no test coverage detected
searching dependent graphs…