mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Try this
This commit is contained in:
parent
7ca71efc4c
commit
f22bdf568d
1 changed files with 13 additions and 9 deletions
22
src/app.jsx
22
src/app.jsx
|
@ -329,6 +329,7 @@ function App() {
|
||||||
__BENCHMARK.start('app-init');
|
__BENCHMARK.start('app-init');
|
||||||
__BENCHMARK.start('time-to-following');
|
__BENCHMARK.start('time-to-following');
|
||||||
__BENCHMARK.start('time-to-home');
|
__BENCHMARK.start('time-to-home');
|
||||||
|
__BENCHMARK.start('time-to-route-root');
|
||||||
useLingui();
|
useLingui();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -460,6 +461,17 @@ function App() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Root({ isLoggedIn, loading }) {
|
||||||
|
__BENCHMARK.end('time-to-route-root');
|
||||||
|
return isLoggedIn ? (
|
||||||
|
<Home />
|
||||||
|
) : loading ? (
|
||||||
|
<Loader id="loader-root" />
|
||||||
|
) : (
|
||||||
|
<Welcome />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function PrimaryRoutes({ isLoggedIn, loading }) {
|
function PrimaryRoutes({ isLoggedIn, loading }) {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const nonRootLocation = useMemo(() => {
|
const nonRootLocation = useMemo(() => {
|
||||||
|
@ -471,15 +483,7 @@ function PrimaryRoutes({ isLoggedIn, loading }) {
|
||||||
<Routes location={nonRootLocation || location}>
|
<Routes location={nonRootLocation || location}>
|
||||||
<Route
|
<Route
|
||||||
path="/"
|
path="/"
|
||||||
element={
|
element={<Root isLoggedIn={isLoggedIn} loading={loading} />}
|
||||||
isLoggedIn ? (
|
|
||||||
<Home />
|
|
||||||
) : loading ? (
|
|
||||||
<Loader id="loader-root" />
|
|
||||||
) : (
|
|
||||||
<Welcome />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<Route path="/login" element={<Login />} />
|
<Route path="/login" element={<Login />} />
|
||||||
<Route path="/welcome" element={<Welcome />} />
|
<Route path="/welcome" element={<Welcome />} />
|
||||||
|
|
Loading…
Reference in a new issue