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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: avoid storage type tag flash
Sidwebworks8ef67a424345
diff --git a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsxindex 5cba581757..18223bbcdf 100644--- a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx+++ b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx@@ -42,6 +42,7 @@ type StorageUnitsTableProps = {count: number;locations: { id: string; name: string }[];locationId: string;+ storageTypes: { id: string; name: string }[];};const StorageUnitsTable = memo(@@ -49,7 +50,8 @@ const StorageUnitsTable = memo(data,count,locations: serverLocations,- locationId+ locationId,+ storageTypes: serverStorageTypes}: StorageUnitsTableProps) => {const [params] = useUrlParams();const { t } = useLingui();@@ -67,7 +69,19 @@ const StorageUnitsTable = memo(return clientLocations;}, [serverLocations, clientLocations]);- const storageTypes = useStorageTypes();+ // Storage types come from the server loader so the Storage Types column+ // resolves names on first paint. Fall back to the client-side+ // useStorageTypes() hook only if the server payload is somehow missing.+ const clientStorageTypes = useStorageTypes();+ const storageTypes = useMemo(() => {+ if (serverStorageTypes && serverStorageTypes.length > 0) {+ return serverStorageTypes.map((st) => ({+ value: st.id,+ label: st.name+ }));+ }+ return clientStorageTypes;+ }, [serverStorageTypes, clientStorageTypes]);const columns = useMemo<ColumnDef<StorageUnit>[]>(() => {return [diff --git a/apps/erp/app/routes/x+/inventory+/storage-units.tsx b/apps/erp/app/routes/x+/inventory+/storage-units.tsxindex e356d45a4f..27cc1e043d 100644--- a/apps/erp/app/routes/x+/inventory+/storage-units.tsx+++ b/apps/erp/app/routes/x+/inventory+/storage-units.tsx@@ -5,7 +5,7 @@ import { VStack } from "@carbon/react";import { msg } from "@lingui/core/macro";import type { LoaderFunctionArgs } from "react-router";import { Outlet, redirect, useLoaderData } from "react-router";-import { getStorageUnits } from "~/modules/inventory";+import { getStorageTypesList, getStorageUnits } from "~/modules/inventory";import StorageUnitsTable from "~/modules/inventory/ui/StorageUnits/StorageUnitsTable";import { getLocationsList } from "~/modules/resources";import { getUserDefaults } from "~/modules/users/users.server";@@ -67,13 +67,19 @@ export async function loader({ request }: LoaderFunctionArgs) {locationId = locationsList.data[0].id as string;}- const storageUnits = await getStorageUnits(client, locationId, companyId, {- search,- limit,- offset,- sorts,- filters- });+ const [storageUnits, storageTypesList] = await Promise.all([+ getStorageUnits(client, locationId, companyId, {+ search,+ limit,+ offset,+ sorts,+ filters+ }),+ // Fetch storage types server-side so the Storage Types column can render+ // resolved names on first paint instead of flashing raw ids while the+ // client-side useStorageTypes() fetcher catches up.+ getStorageTypesList(client, companyId)+ ]);if (storageUnits.error) {throw redirect(@@ -89,12 +95,13 @@ export async function loader({ request }: LoaderFunctionArgs) {count: storageUnits.count ?? 0,storageUnits: storageUnits.data ?? [],locations: locationsList.data,- locationId+ locationId,+ storageTypes: storageTypesList.data ?? []};}export default function StorageUnitsRoute() {- const { count, storageUnits, locations, locationId } =+ const { count, storageUnits, locations, locationId, storageTypes } =useLoaderData<typeof loader>();// storageUnits comes from storageUnits_recursive (a view) so every column@@ -118,6 +125,7 @@ export default function StorageUnitsRoute() {count={count}locations={locations}locationId={locationId}+ storageTypes={storageTypes}/><Outlet /></VStack>