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.

fix: simplify matchedModules validation

Sidwebworks01a339395c9b
diff --git a/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx b/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
index 655d130e27..a93715c8ec 100644
--- a/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
+++ b/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
@@ -1,25 +1,19 @@
import { VStack, cn, useDisclosure } from "@carbon/react";
import { Link, useMatches } from "@remix-run/react";
-import { forwardRef, type AnchorHTMLAttributes, memo } from "react";
-import { z } from "zod/v3";
+import { forwardRef, memo, type AnchorHTMLAttributes } from "react";
import { useModules, useOptimisticLocation } from "~/hooks";
import type { Authenticated, NavItem } from "~/types";
-export const ModuleHandle = z.object({
- module: z.string(),
-});
-
const PrimaryNavigation = () => {
const navigationPanel = useDisclosure();
const location = useOptimisticLocation();
const currentModule = getModule(location.pathname);
const links = useModules();
const matchedModules = useMatches().reduce((acc, match) => {
- if (match.handle) {
- const result = ModuleHandle.safeParse(match.handle);
- if (result.success) {
- acc.add(result.data.module);
- }
+ const handle = match.handle as { module?: string } | undefined;
+
+ if (handle && typeof handle.module === "string") {
+ acc.add(handle.module);
}
return acc;