Skip to content

Commit 5cacef4

Browse files
sampottscursoragent
andcommitted
fix(sandbox): wait for locale registration before rendering i18n UI
Avoid a flash of English copy when the sandbox locale changes after mount. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d8f3d06 commit 5cacef4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • apps/sandbox/templates/react-video

apps/sandbox/templates/react-video/main.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ function App() {
3434
const loop = useLoop();
3535
const preload = usePreload();
3636
const locale = useLocale();
37-
const [ready, setReady] = useState(false);
37+
const [registeredLocale, setRegisteredLocale] = useState<string | null>(null);
3838

3939
useEffect(() => {
4040
ensureSandboxLocale(locale);
41-
setReady(true);
41+
setRegisteredLocale(locale);
4242
}, [locale]);
4343

44-
if (!ready) {
44+
if (registeredLocale !== locale) {
4545
return null;
4646
}
4747

0 commit comments

Comments
 (0)