Skip to content

Open source CapCut alternative.

TypeScript

fix(site): the browser's translator can't take the editor down

David Le7ccccea89763
diff --git a/site/src/app/_components/landing/AuthScreen.tsx b/site/src/app/_components/landing/AuthScreen.tsx
index bb99764f..19cd55d9 100644
--- a/site/src/app/_components/landing/AuthScreen.tsx
+++ b/site/src/app/_components/landing/AuthScreen.tsx
@@ -139,7 +139,12 @@ export function AuthScreen({ mode }: Props) {
);
return (
- <main className="min-h-screen w-full bg-background font-system text-ink antialiased">
+ // Sign-in is a client tree the browser's translator rewrites out from
+ // under hydration; the app it leads into is marked the same way.
+ <main
+ translate="no"
+ className="min-h-screen w-full bg-background font-system text-ink antialiased"
+ >
{/* Auth serves same-host on donkeycut.com, so the chrome is Cut's. */}
<TopNav
wordmark="Donkey Cut"
diff --git a/site/src/app/cut/app/layout.tsx b/site/src/app/cut/app/layout.tsx
index 50385f76..fba9c32c 100644
--- a/site/src/app/cut/app/layout.tsx
+++ b/site/src/app/cut/app/layout.tsx
@@ -26,7 +26,16 @@ import { SessionGate, SessionSkeleton } from "@/cut/components/SessionGate";
export default function CutAppLayout({ children }: { children: ReactNode }) {
return (
- <div className="min-h-screen bg-white font-system text-foreground antialiased">
+ // translate="no" covers the whole app subtree. A browser's built-in
+ // translator rewrites text nodes in place under a running React tree: the
+ // rewrite lands mid-hydration as a text mismatch, and then a later commit
+ // that moves one of the rewritten nodes throws NotFoundError out of
+ // insertBefore and takes the editor down. The editor's text is chrome
+ // around a canvas, so the page keeps its own words and stays standing.
+ <div
+ translate="no"
+ className="min-h-screen bg-white font-system text-foreground antialiased"
+ >
<AppSurfaceBackground />
<NoSessionReplay />
{/* A route whose address carries data — the editor's project id — can't be
diff --git a/site/src/app/cut/s/[token]/page.tsx b/site/src/app/cut/s/[token]/page.tsx
index bf9f2d91..939ab3fa 100644
--- a/site/src/app/cut/s/[token]/page.tsx
+++ b/site/src/app/cut/s/[token]/page.tsx
@@ -82,7 +82,13 @@ export default function SharedProjectPage() {
return (
<>
<NoSessionReplay />
- <SharedProjectView />
+ {/* Same reason the app subtree is marked (app/cut/app/layout.tsx): a
+ browser's translator rewriting text nodes under this tree breaks
+ hydration and then a later commit. `contents` keeps the wrapper out
+ of the layout the view below sets up. */}
+ <div translate="no" className="contents">
+ <SharedProjectView />
+ </div>
</>
);
}