Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

build: try lazy loading some components to reduce edge funciton size

Brad Barbin1307c9ee0abf
diff --git a/apps/carbon/app/routes/x+/supplier-quote+/$id.tsx b/apps/carbon/app/routes/x+/supplier-quote+/$id.tsx
index a3b7cf999b..fd0659d9f8 100644
--- a/apps/carbon/app/routes/x+/supplier-quote+/$id.tsx
+++ b/apps/carbon/app/routes/x+/supplier-quote+/$id.tsx
@@ -5,6 +5,7 @@ import { VStack } from "@carbon/react";
import { Outlet, useParams } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { defer, redirect } from "@vercel/remix";
+import { lazy, Suspense } from "react";
import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";
import { getCurrencyByCode } from "~/modules/accounting";
import {
@@ -14,12 +15,17 @@ import {
getSupplierQuoteLinePricesByQuoteId,
getSupplierQuoteLines,
SupplierQuoteHeader,
- SupplierQuoteProperties,
} from "~/modules/purchasing";
-import SupplierQuoteExplorer from "~/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer";
import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
+const SupplierQuoteExplorer = lazy(
+ () => import("~/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer")
+);
+const SupplierQuoteProperties = lazy(
+ () => import("~/modules/purchasing/ui/SupplierQuote/SupplierQuoteProperties")
+);
+
export const handle: Handle = {
breadcrumb: "Supplier Quotes",
to: path.to.supplierQuotes,
@@ -88,17 +94,19 @@ export default function SupplierQuoteRoute() {
<SupplierQuoteHeader />
<div className="flex h-[calc(100dvh-99px)] overflow-hidden w-full">
<div className="flex flex-grow overflow-hidden">
- <ResizablePanels
- explorer={<SupplierQuoteExplorer />}
- content={
- <div className="h-[calc(100dvh-99px)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">
- <VStack spacing={2} className="p-2">
- <Outlet />
- </VStack>
- </div>
- }
- properties={<SupplierQuoteProperties />}
- />
+ <Suspense fallback={null}>
+ <ResizablePanels
+ explorer={<SupplierQuoteExplorer />}
+ content={
+ <div className="h-[calc(100dvh-99px)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">
+ <VStack spacing={2} className="p-2">
+ <Outlet />
+ </VStack>
+ </div>
+ }
+ properties={<SupplierQuoteProperties />}
+ />
+ </Suspense>
</div>
</div>
</div>