Skip to content

Commit b7d95fe

Browse files
committed
376 - client - Load session first, before showing layout
1 parent ede578a commit b7d95fe

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

client/src/App.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@ function App() {
198198
// eslint-disable-next-line react-hooks/exhaustive-deps
199199
}, [authenticated]);
200200

201+
if (!sessionHasBeenFetched) {
202+
return (
203+
<div className="flex min-h-screen min-w-full items-center justify-center p-5">
204+
<div className="flex animate-pulse space-x-2">
205+
<div className="size-3 rounded-full bg-gray-500"></div>
206+
207+
<div className="size-3 rounded-full bg-gray-500"></div>
208+
209+
<div className="size-3 rounded-full bg-gray-500"></div>
210+
</div>
211+
</div>
212+
);
213+
}
214+
201215
return authenticated ? (
202216
<div className="flex h-full">
203217
<MobileSidebar

client/src/pages/home/Home.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const Home = () => {
1919
useEffect(() => {
2020
if (!ff_520) {
2121
navigate('/automation');
22+
23+
return;
2224
}
2325

2426
if (currentType !== undefined) {

client/src/routes.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ export const getRouter = (queryClient: QueryClient) =>
165165
},
166166
{
167167
children: [
168+
{
169+
element: <Home />,
170+
index: true,
171+
},
168172
{
169173
children: [
170174
{
@@ -379,10 +383,6 @@ export const getRouter = (queryClient: QueryClient) =>
379383
errorElement: <ErrorPage />,
380384
path: 'embedded',
381385
},
382-
{
383-
element: <Home />,
384-
index: true,
385-
},
386386
],
387387
path: '/',
388388
},

0 commit comments

Comments
 (0)