Skip to content

Commit

Permalink
376 - client - Load session first, before showing layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ivicac committed Nov 12, 2024
1 parent ede578a commit b7d95fe
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
14 changes: 14 additions & 0 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ function App() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [authenticated]);

if (!sessionHasBeenFetched) {
return (
<div className="flex min-h-screen min-w-full items-center justify-center p-5">
<div className="flex animate-pulse space-x-2">
<div className="size-3 rounded-full bg-gray-500"></div>

<div className="size-3 rounded-full bg-gray-500"></div>

<div className="size-3 rounded-full bg-gray-500"></div>
</div>
</div>
);
}

return authenticated ? (
<div className="flex h-full">
<MobileSidebar
Expand Down
2 changes: 2 additions & 0 deletions client/src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const Home = () => {
useEffect(() => {
if (!ff_520) {
navigate('/automation');

return;
}

if (currentType !== undefined) {
Expand Down
8 changes: 4 additions & 4 deletions client/src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ export const getRouter = (queryClient: QueryClient) =>
},
{
children: [
{
element: <Home />,
index: true,
},
{
children: [
{
Expand Down Expand Up @@ -379,10 +383,6 @@ export const getRouter = (queryClient: QueryClient) =>
errorElement: <ErrorPage />,
path: 'embedded',
},
{
element: <Home />,
index: true,
},
],
path: '/',
},
Expand Down

0 comments on commit b7d95fe

Please sign in to comment.