mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-31 02:51:36 +02:00
Got to solve this mystery
This commit is contained in:
parent
f22bdf568d
commit
1664aa3cf4
1 changed files with 7 additions and 4 deletions
11
src/app.jsx
11
src/app.jsx
|
@ -2,6 +2,7 @@ import './app.css';
|
||||||
|
|
||||||
import { useLingui } from '@lingui/react';
|
import { useLingui } from '@lingui/react';
|
||||||
import debounce from 'just-debounce-it';
|
import debounce from 'just-debounce-it';
|
||||||
|
import { memo } from 'preact/compat';
|
||||||
import {
|
import {
|
||||||
useEffect,
|
useEffect,
|
||||||
useLayoutEffect,
|
useLayoutEffect,
|
||||||
|
@ -329,7 +330,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');
|
__BENCHMARK.start('time-to-isLoggedIn');
|
||||||
useLingui();
|
useLingui();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -462,7 +463,9 @@ function App() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Root({ isLoggedIn, loading }) {
|
function Root({ isLoggedIn, loading }) {
|
||||||
__BENCHMARK.end('time-to-route-root');
|
if (isLoggedIn) {
|
||||||
|
__BENCHMARK.end('time-to-isLoggedIn');
|
||||||
|
}
|
||||||
return isLoggedIn ? (
|
return isLoggedIn ? (
|
||||||
<Home />
|
<Home />
|
||||||
) : loading ? (
|
) : loading ? (
|
||||||
|
@ -472,7 +475,7 @@ function Root({ isLoggedIn, loading }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function PrimaryRoutes({ isLoggedIn, loading }) {
|
const PrimaryRoutes = memo(({ isLoggedIn, loading }) => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const nonRootLocation = useMemo(() => {
|
const nonRootLocation = useMemo(() => {
|
||||||
const { pathname } = location;
|
const { pathname } = location;
|
||||||
|
@ -489,7 +492,7 @@ function PrimaryRoutes({ isLoggedIn, loading }) {
|
||||||
<Route path="/welcome" element={<Welcome />} />
|
<Route path="/welcome" element={<Welcome />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
|
||||||
function getPrevLocation() {
|
function getPrevLocation() {
|
||||||
return states.prevLocation || null;
|
return states.prevLocation || null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue