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
refactor: fix drawer redirect bug in part groups crud
Brad Barbinb89671727f9f
diff --git a/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable.tsx b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable.tsxindex 192a8935a8..1092e4d713 100644--- a/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable.tsx+++ b/apps/carbon/app/modules/parts/ui/PartGroups/PartGroupsTable.tsx@@ -29,7 +29,11 @@ const PartGroupsTable = memo(({ data, count }: PartGroupsTableProps) => {cell: ({ row }) => (<Enumerablevalue={row.original.name}- onClick={() => navigate(row.original.id)}+ onClick={() =>+ navigate(+ `${path.to.partGroup(row.original.id)}?${params.toString()}`+ )+ }className="cursor-pointer"/>),@@ -40,7 +44,7 @@ const PartGroupsTable = memo(({ data, count }: PartGroupsTableProps) => {cell: (item) => item.getValue(),},],- [navigate]+ [navigate, params]);const renderContextMenu = useCallback(@@ -79,7 +83,7 @@ const PartGroupsTable = memo(({ data, count }: PartGroupsTableProps) => {columns={columns}count={count}label="Part Group"- newPath={path.to.newPartGroup}+ newPath={`${path.to.newPartGroup}?${params.toString()}`}newPermission={permissions.can("create", "parts")}renderContextMenu={renderContextMenu}/>diff --git a/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx b/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsxindex e4a6358f48..416180c200 100644--- a/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx+++ b/apps/carbon/app/routes/x+/parts+/groups.$groupId.tsx@@ -12,7 +12,7 @@ import { requirePermissions } from "~/services/auth";import { flash } from "~/services/session.server";import { getCustomFields, setCustomFields } from "~/utils/form";import { assertIsPost, notFound } from "~/utils/http";-import { path } from "~/utils/path";+import { getParams, path } from "~/utils/path";import { error, success } from "~/utils/result";export async function loader({ request, params }: LoaderFunctionArgs) {@@ -65,7 +65,7 @@ export async function action({ request, params }: ActionFunctionArgs) {}return redirect(- path.to.partGroups,+ `${path.to.partGroups}?${getParams(request)}`,await flash(request, success("Updated part group")));}diff --git a/apps/carbon/app/routes/x+/parts+/groups.delete.$groupId.tsx b/apps/carbon/app/routes/x+/parts+/groups.delete.$groupId.tsxindex 82f0740b68..7f63a6084c 100644--- a/apps/carbon/app/routes/x+/parts+/groups.delete.$groupId.tsx+++ b/apps/carbon/app/routes/x+/parts+/groups.delete.$groupId.tsx@@ -6,7 +6,7 @@ import { deletePartGroup, getPartGroup } from "~/modules/parts";import { requirePermissions } from "~/services/auth";import { flash } from "~/services/session.server";import { notFound } from "~/utils/http";-import { path } from "~/utils/path";+import { getParams, path } from "~/utils/path";import { error, success } from "~/utils/result";export async function loader({ request, params }: LoaderFunctionArgs) {@@ -43,7 +43,7 @@ export async function action({ request, params }: ActionFunctionArgs) {const { error: deleteTypeError } = await deletePartGroup(client, groupId);if (deleteTypeError) {return redirect(- path.to.partGroups,+ `${path.to.partGroups}?${getParams(request)}`,await flash(request,error(deleteTypeError, "Failed to delete part group")@@ -66,7 +66,7 @@ export default function DeletePartGroupRoute() {if (!partGroup) return null;- const onCancel = () => navigate(path.to.partGroups);+ const onCancel = () => navigate(-1);return (<ConfirmDeletediff --git a/apps/carbon/app/routes/x+/parts+/groups.new.tsx b/apps/carbon/app/routes/x+/parts+/groups.new.tsxindex 702d2d75ea..3b1722fadb 100644--- a/apps/carbon/app/routes/x+/parts+/groups.new.tsx+++ b/apps/carbon/app/routes/x+/parts+/groups.new.tsx@@ -11,7 +11,7 @@ import { requirePermissions } from "~/services/auth";import { flash } from "~/services/session.server";import { setCustomFields } from "~/utils/form";import { assertIsPost } from "~/utils/http";-import { path } from "~/utils/path";+import { getParams, path } from "~/utils/path";import { error, success } from "~/utils/result";export async function loader({ request }: LoaderFunctionArgs) {@@ -68,7 +68,7 @@ export async function action({ request }: ActionFunctionArgs) {return modal? json(insertPartGroup, { status: 201 }): redirect(- path.to.partGroups,+ `${path.to.partGroups}?${getParams(request)}`,await flash(request, success("Part group created")));}