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 shipping methods crud

Brad Barbin9c3a5df14b20
diff --git a/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable.tsx b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable.tsx
index 61e4ba5ed0..d5ae18e435 100644
--- a/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable.tsx
+++ b/apps/carbon/app/modules/inventory/ui/ShippingMethods/ShippingMethodsTable.tsx
@@ -30,7 +30,15 @@ const ShippingMethodsTable = memo(
accessorKey: "name",
header: "Name",
cell: ({ row }) => (
- <Hyperlink onClick={() => navigate(row.original.id)}>
+ <Hyperlink
+ onClick={() =>
+ navigate(
+ `${path.to.shippingMethod(
+ row.original.id
+ )}?${params.toString()}`
+ )
+ }
+ >
{row.original.name}
</Hyperlink>
),
diff --git a/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx b/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx
index ef831f3436..6741747f31 100644
--- a/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx
+++ b/apps/carbon/app/routes/x+/inventory+/shipping-methods.$shippingMethodId.tsx
@@ -13,7 +13,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) {
@@ -68,7 +68,7 @@ export async function action({ request }: ActionFunctionArgs) {
}
return redirect(
- path.to.shippingMethods,
+ `${path.to.shippingMethods}?${getParams(request)}`,
await flash(request, success("Updated shipping method"))
);
}
diff --git a/apps/carbon/app/routes/x+/inventory+/shipping-methods.delete.$shippingMethodId.tsx b/apps/carbon/app/routes/x+/inventory+/shipping-methods.delete.$shippingMethodId.tsx
index e0d43770b6..ebb5717345 100644
--- a/apps/carbon/app/routes/x+/inventory+/shipping-methods.delete.$shippingMethodId.tsx
+++ b/apps/carbon/app/routes/x+/inventory+/shipping-methods.delete.$shippingMethodId.tsx
@@ -6,7 +6,7 @@ import { deleteShippingMethod, getShippingMethod } from "~/modules/inventory";
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) {
@@ -58,7 +58,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
}
return redirect(
- path.to.shippingMethods,
+ `${path.to.shippingMethods}?${getParams(request)}`,
await flash(request, success("Successfully deleted shipping method"))
);
}
diff --git a/apps/carbon/app/routes/x+/inventory+/shipping-methods.new.tsx b/apps/carbon/app/routes/x+/inventory+/shipping-methods.new.tsx
index ea4362532e..968e346263 100644
--- a/apps/carbon/app/routes/x+/inventory+/shipping-methods.new.tsx
+++ b/apps/carbon/app/routes/x+/inventory+/shipping-methods.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) {
@@ -66,7 +66,7 @@ export async function action({ request }: ActionFunctionArgs) {
}
return redirect(
- path.to.shippingMethods,
+ `${path.to.shippingMethods}?${getParams(request)}`,
await flash(request, success("Shipping method created"))
);
}