Skip to content

Commit

Permalink
🐬 remove loading page
Browse files Browse the repository at this point in the history
the loading page was only used in cases where the app loads fast. This IMO improves UX by not flashing unnescessary content
  • Loading branch information
anuejn committed Dec 3, 2023
1 parent 170129f commit 4434016
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
7 changes: 3 additions & 4 deletions frontend/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { ModalHolder } from './components/modal';
import { Helmet } from 'react-helmet';
import { registerCopyHandler } from './utils/copy_text';
import { useAuthData } from './utils/auth';
import { LoadingPage } from './pages/loading';
import { PagePage } from './pages/page';
import { AboutPage } from './pages/about';
import { useGetConfig } from './api/config';
Expand All @@ -24,7 +23,7 @@ export function AuthenticatedRoute<T extends DefaultParams = DefaultParams>({
const { isLoggedIn, hasShareToken, isLoading } = useAuthData();
const isAuthenticated = isLoggedIn || hasShareToken;
if (isLoading) {
return <Route component={LoadingPage} />;
return null;
}
if (!isAuthenticated) {
navigate('/login');
Expand All @@ -39,7 +38,7 @@ export function LoggedInRoute<T extends DefaultParams = DefaultParams>({
const [_, navigate] = useLocation();
const { isLoggedIn, isLoading } = useAuthData();
if (isLoading) {
return <Route component={LoadingPage} />;
return null;
}
if (!isLoggedIn) {
navigate('/login');
Expand All @@ -65,7 +64,7 @@ export function LoggedInRedirectRoute<T extends DefaultParams = DefaultParams>({
if (isLoggedIn) {
return <Route {...props} />;
} else {
return <Route component={LoadingPage} />;
return null;
}
}

Expand Down
21 changes: 0 additions & 21 deletions frontend/src/pages/loading.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions frontend/src/pages/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { AppCenter } from '../components/app';
import ReactMarkdown from 'react-markdown';
import { getPage, useGetPage } from '../api/pages';
import { PageNotFoundPage } from './page_not_found';
import { LoadingPage } from './loading';

export function PagePage({ params: { pageId } }: RouteComponentProps<{ pageId: string }>) {
const { data, error } = useGetPage({ page_id: pageId });
Expand All @@ -14,7 +13,7 @@ export function PagePage({ params: { pageId } }: RouteComponentProps<{ pageId: s
}
}
if (!data) {
return <LoadingPage />;
return null;
}
return (
<AppCenter>
Expand Down

0 comments on commit 4434016

Please sign in to comment.