Skip to content

Commit

Permalink
feat: remove lazy loading
Browse files Browse the repository at this point in the history
  • Loading branch information
AKharytonchyk committed Nov 5, 2024
1 parent a62fcbb commit c9b5103
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 46 deletions.
10 changes: 3 additions & 7 deletions src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Suspense, useEffect } from "react";
import React, { useEffect } from "react";
import { ConfigContext } from "../App";
import { PullRequest } from "../models/PullRequest";
import PullRequestCard from "./PullRequestCard";
Expand All @@ -9,7 +9,7 @@ import { MultiselectFilter } from "./MultiselectFilter";
import { InputFilter } from "./InputFilter";
import { useQueries } from "@tanstack/react-query";
import { Navigate } from "react-router-dom";
import PRLoadingPageLazy from "../pages/PrLoadingPage.lazy";
import PRLoadingPage from "../pages/PRLoadingPage";

export const Dashboard: React.FC = () => {
const { octokit, repositorySettings } = React.useContext(ConfigContext);
Expand Down Expand Up @@ -93,11 +93,7 @@ export const Dashboard: React.FC = () => {

return (
<Box padding={2} width={"calc(100vw - 2em)"}>
{pending && data.length === 0 && (
<Suspense fallback={<div>Loading...</div>}>
<PRLoadingPageLazy />
</Suspense>
)}
{pending && data.length === 0 && <PRLoadingPage />}
{!pending && data.length === 0 && <LandingPage />}
{data.length > 0 && (
<>
Expand Down
26 changes: 7 additions & 19 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { Suspense } from "react";
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { RouterProvider, createHashRouter } from "react-router-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ScopedCssBaseline } from "@mui/material";
import LandingPage from "./pages/LandingPage.lazy";
import Dashboard from "./pages/Dashboard.lazy";
import Coverage from "./pages/Coverage.lazy";
import Coverage from "./pages/Coverage";
import LandingPage from "./pages/LandingPage";
import Dashboard from "./components/Dashboard";

const router = createHashRouter([
{
Expand All @@ -17,27 +17,15 @@ const router = createHashRouter([
children: [
{
path: "/",
element: (
<Suspense fallback={<div>Loading...</div>}>
<Dashboard />
</Suspense>
),
element: <Dashboard />,
},
{
path: "/login",
element: (
<Suspense fallback={<div>Loading...</div>}>
<LandingPage />
</Suspense>
),
element: <LandingPage />,
},
{
path: "/coverage",
element: (
<Suspense fallback={<div>Loading...</div>}>
<Coverage />
</Suspense>
),
element: <Coverage />,
},
],
},
Expand Down
5 changes: 0 additions & 5 deletions src/pages/Coverage.lazy.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/pages/Dashboard.lazy.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/pages/LandingPage.lazy.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/pages/PrLoadingPage.lazy.tsx

This file was deleted.

0 comments on commit c9b5103

Please sign in to comment.