Open source CapCut alternative.
TypeScript
fix(site): the app surface is white from the first painted frame
David Le2044660b7737
diff --git a/site/src/app/layout.tsx b/site/src/app/layout.tsxindex a6c895d8..dbdffaa6 100644--- a/site/src/app/layout.tsx+++ b/site/src/app/layout.tsx@@ -39,9 +39,14 @@ export default function RootLayout({children: React.ReactNode;}>) {return (+ // The /app subtree adds its surface class to html from an inline script so+ // the first painted frame is already white (AppSurfaceBackground). The+ // served markup and the DOM React hydrates differ by that class on+ // purpose, and this is the element it lands on.<htmllang="en"className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}+ suppressHydrationWarning><body className="min-h-full flex flex-col"><PostHogProvider>diff --git a/site/src/components/AppSurfaceBackground.tsx b/site/src/components/AppSurfaceBackground.tsxindex 9db44462..51b5210d 100644--- a/site/src/components/AppSurfaceBackground.tsx+++ b/site/src/components/AppSurfaceBackground.tsx@@ -2,16 +2,22 @@import { useEffect } from "react";+const SURFACE = "app-surface";+// The signed-in /app surface renders on white, but the root html/body default to// the cream landing background — which shows through in the browser overscroll-// area above the content. While the app is mounted we flag the html element so a-// scoped rule in globals.css paints it (and the overscroll) white instead.+// area above the content, and in every element keyed to bg-background until the+// app has hydrated. The flag goes on the html element inline, so the first+// painted frame is already the product surface, and comes back off when the app+// unmounts and the landing pages take the root back.+const paint = `document.documentElement.classList.add(${JSON.stringify(SURFACE)})`;+export function AppSurfaceBackground() {useEffect(() => {const root = document.documentElement;- root.classList.add("app-surface");- return () => root.classList.remove("app-surface");+ root.classList.add(SURFACE);+ return () => root.classList.remove(SURFACE);}, []);- return null;+ return <script dangerouslySetInnerHTML={{ __html: paint }} />;}diff --git a/site/src/cut/components/editor-mock/MockAiPanel.tsx b/site/src/cut/components/editor-mock/MockAiPanel.tsxindex 4ae69972..e354830f 100644--- a/site/src/cut/components/editor-mock/MockAiPanel.tsx+++ b/site/src/cut/components/editor-mock/MockAiPanel.tsx@@ -49,9 +49,9 @@ export function MockAiPanel({ project }: { project: MockProject }) {</div><div className="shrink-0 px-2.5 pb-2.5">- {/* The real composer is bg-background, which the editor's app-surface- paints white; on the cream landing that token stays cream, so the- mock pins white directly. */}+ {/* The real composer is bg-background, which the app surface paints+ white; on the cream landing that token stays cream, so the mock+ pins white directly. */}<div className="rounded-xl border border-input bg-white"><div className="min-h-9 px-3 pt-2 text-[12.5px] leading-relaxed text-muted-foreground/70">Ask about your video, or tell me what to change… @ references media