Skip to content

Commit 7d694d0

Browse files
authored
fix(routes): redirect / => /en-US/ except for writers (#10778)
Previously, http://localhost:3000/ showed an incomplete homepage, except for writers (WRITER_MODE=true) who see the writer's homepage. Now, we redirect to /en-US/ for developers, to avoid confusion.
1 parent 40be4dd commit 7d694d0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Diff for: client/src/app.tsx

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React, { useEffect } from "react";
2-
import { Routes, Route, useLocation, useMatch } from "react-router-dom";
2+
import {
3+
Navigate,
4+
Routes,
5+
Route,
6+
useLocation,
7+
useMatch,
8+
} from "react-router-dom";
39

410
// we include our base SASS here to ensure it is loaded
511
// and applied before any component specific style
@@ -161,10 +167,13 @@ export function App(appProps: HydrationData) {
161167
{/*
162168
Note, this can only happen in local development.
163169
In production, all traffic at `/` is redirected to at least
164-
having a locale. So it'll be `/en-US` (for example) by the
170+
having a locale. So it'll be `/en-US/` (for example) by the
165171
time it hits any React code.
166172
*/}
167-
<Route path="/" element={homePage} />
173+
<Route
174+
path="/"
175+
element={WRITER_MODE ? homePage : <Navigate to="/en-US/" />}
176+
/>
168177
<Route
169178
path="/en-US/curriculum/*"
170179
element={

0 commit comments

Comments
 (0)