Use custom lazy for loading components

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Jonathan
2025-06-11 18:39:11 +02:00
committed by Sacha Al Himdani
parent 1ba61f691e
commit e1b63b59a6
13 changed files with 47 additions and 43 deletions

View File

@@ -8,13 +8,7 @@ import {
} from "react-router";
import { MainLayout } from "./layouts/MainLayout";
import { AuthLayout, CenteredLayout, CenteredLayoutSkeleton } from "@probo/ui";
import {
Fragment,
lazy,
Suspense,
type FC,
type LazyExoticComponent,
} from "react";
import { Fragment, Suspense, type FC, type LazyExoticComponent } from "react";
import {
relayEnvironment,
UnAuthenticatedError,
@@ -31,8 +25,9 @@ import { peopleRoutes } from "./routes/peopleRoutes.ts";
import { frameworkRoutes } from "./routes/frameworkRoutes.ts";
import { PageError } from "./components/PageError.tsx";
import { taskRoutes } from "./routes/taskRoutes.ts";
import { lazy } from "@probo/react-lazy";
function ErrorBoundary(props) {
function ErrorBoundary() {
const error = useRouteError();
if (error instanceof UnAuthenticatedError) {

View File

@@ -1,4 +1,4 @@
import { Fragment, lazy } from "react";
import { Fragment } from "react";
import { loadQuery } from "react-relay";
import type { AppRoute } from "/routes.tsx";
import { relayEnvironment } from "/providers/RelayProviders";
@@ -6,6 +6,7 @@ import { documentsQuery } from "/hooks/graph/DocumentGraph";
import { documentNodeQuery } from "/hooks/graph/DocumentGraph";
import { PageSkeleton } from "/components/skeletons/PageSkeleton";
import { redirect } from "react-router";
import { lazy } from "@probo/react-lazy";
export const documentsRoutes = [
{

View File

@@ -6,7 +6,8 @@ import {
frameworkNodeQuery,
} from "/hooks/graph/FrameworkGraph";
import type { AppRoute } from "/routes";
import { Fragment, lazy } from "react";
import { Fragment } from "react";
import { lazy } from "@probo/react-lazy";
export const frameworkRoutes = [
{

View File

@@ -1,10 +1,11 @@
import { Fragment, lazy } from "react";
import { Fragment } from "react";
import { loadQuery } from "react-relay";
import type { AppRoute } from "/routes.tsx";
import { relayEnvironment } from "/providers/RelayProviders";
import { measureNodeQuery, measuresQuery } from "/hooks/graph/MeasureGraph";
import { PageSkeleton } from "/components/skeletons/PageSkeleton";
import { redirect } from "react-router";
import { lazy } from "@probo/react-lazy";
export const measureRoutes = [
{

View File

@@ -1,4 +1,4 @@
import { lazy } from "react";
import { lazy } from "@probo/react-lazy";
import { loadQuery } from "react-relay";
import type { AppRoute } from "/routes.tsx";
import { relayEnvironment } from "/providers/RelayProviders";

View File

@@ -1,11 +1,12 @@
import { Fragment, lazy } from "react";
import { Fragment } from "react";
import { loadQuery } from "react-relay";
import { RisksPageSkeleton } from "/components/skeletons/RisksPageSkeleton.tsx";
import type { AppRoute } from "/routes.tsx";
import { relayEnvironment } from "/providers/RelayProviders";
import { riskNodeQuery, risksQuery } from "/hooks/graph/RiskGraph";
import { PageSkeleton } from "/components/skeletons/PageSkeleton.tsx";
import { PageSkeleton } from "/components/skeletons/PageSkeleton";
import { redirect } from "react-router";
import { lazy } from "@probo/react-lazy";
export const riskRoutes = [
{

View File

@@ -1,4 +1,4 @@
import { lazy } from "react";
import { lazy } from "@probo/react-lazy";
import { PageSkeleton } from "/components/skeletons/PageSkeleton";
import { loadQuery } from "react-relay";
import { relayEnvironment } from "/providers/RelayProviders";

View File

@@ -1,4 +1,4 @@
import { lazy } from "react";
import { lazy } from "@probo/react-lazy";
import { loadQuery } from "react-relay";
import type { AppRoute } from "/routes.tsx";
import { relayEnvironment } from "/providers/RelayProviders";