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.

refactor: fix drawer redirect bug in uom crud

Brad Barbine03608f42573
diff --git a/apps/carbon/app/components/Table/components/TableHeader.tsx b/apps/carbon/app/components/Table/components/TableHeader.tsx
index 99d9cd5543..674be5561f 100644
--- a/apps/carbon/app/components/Table/components/TableHeader.tsx
+++ b/apps/carbon/app/components/Table/components/TableHeader.tsx
@@ -98,7 +98,9 @@ const TableHeader = <T extends object>({
(pagination.canNextPage || pagination.canPreviousPage) && (
<PaginationButtons {...pagination} condensed />
)}
- {!!newPath && !!newPermission && <New to={newPath} label={label} />}
+ {!!newPath && !!newPermission && (
+ <New to={`${newPath}?${params.toString()}`} label={label} />
+ )}
</HStack>
</HStack>
{currentFilters.length > 0 && (
diff --git a/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx b/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx
index 495f23fa25..4e85d2fad0 100644
--- a/apps/carbon/app/routes/x+/parts+/uom.$uomId.tsx
+++ b/apps/carbon/app/routes/x+/parts+/uom.$uomId.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 }: ActionFunctionArgs) {
}
return redirect(
- path.to.uoms,
+ `${path.to.uoms}?${getParams(request)}`,
await flash(request, success("Updated unit of measure"))
);
}
diff --git a/apps/carbon/app/routes/x+/parts+/uom.delete.$uomId.tsx b/apps/carbon/app/routes/x+/parts+/uom.delete.$uomId.tsx
index 356724663a..4b393b1b22 100644
--- a/apps/carbon/app/routes/x+/parts+/uom.delete.$uomId.tsx
+++ b/apps/carbon/app/routes/x+/parts+/uom.delete.$uomId.tsx
@@ -6,7 +6,7 @@ import { deleteUnitOfMeasure, getUnitOfMeasure } 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) {
@@ -19,7 +19,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const unitOfMeasure = await getUnitOfMeasure(client, uomId);
if (unitOfMeasure.error) {
return redirect(
- path.to.uoms,
+ `${path.to.uoms}?${getParams(request)}`,
await flash(
request,
error(unitOfMeasure.error, "Failed to get unit of measure")
diff --git a/apps/carbon/app/routes/x+/parts+/uom.new.tsx b/apps/carbon/app/routes/x+/parts+/uom.new.tsx
index a4e75f73af..2326a301f1 100644
--- a/apps/carbon/app/routes/x+/parts+/uom.new.tsx
+++ b/apps/carbon/app/routes/x+/parts+/uom.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) {
@@ -58,7 +58,7 @@ export async function action({ request }: ActionFunctionArgs) {
return modal
? json(insertUnitOfMeasure, { status: 201 })
: redirect(
- path.to.uoms,
+ `${path.to.uoms}?${getParams(request)}`,
await flash(request, success("Unit of measure created"))
);
}