From c8f8318bd5af9a455b1503a8aae937e6b7c93f65 Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Thu, 15 Oct 2026 17:19:07 -0600 Subject: [PATCH] fix: restore docs width before first paint --- src/components/LibraryLayout.tsx | 16 ++++++++-- src/routes/__root.tsx | 2 ++ src/utils/docs-width.ts | 3 ++ tests/docs-width.test.ts | 53 ++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 src/utils/docs-width.ts create mode 100644 tests/docs-width.test.ts diff --git a/src/components/LibraryLayout.tsx b/src/components/LibraryLayout.tsx index 4ac073ebd..61b48fb0e 100644 --- a/src/components/LibraryLayout.tsx +++ b/src/components/LibraryLayout.tsx @@ -1442,7 +1442,18 @@ export function LibraryLayout({ ) return ( - + { + document.documentElement.style.setProperty( + '--docs-content-width', + fullWidth ? '100%' : '900px', + ) + setIsFullWidth(fullWidth) + }, + }} + > {children} diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index c3d782a5a..bec6e5ce1 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -55,6 +55,7 @@ import { } from '~/utils/analytics/scarf' import { createPartnerPlacementSessionSeed } from '~/utils/partner-placement' import { twMerge } from 'tailwind-merge' +import { DOCS_WIDTH_BOOTSTRAP } from '~/utils/docs-width' const GOOGLE_ANALYTICS_ID = 'G-JMT1Z50SPS' const GOOGLE_ANALYTICS_PROXY_PREFIX = '/_a' @@ -356,6 +357,7 @@ function ShellComponent({ children }: { children: React.ReactNode }) { dangerouslySetInnerHTML={{ __html: THEME_BOOTSTRAP }} suppressHydrationWarning /> +