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: update sonner version in ERP and fix routing (#587)

Naveen Kashyap039676a362c4
diff --git a/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegisterForm.tsx b/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegisterForm.tsx
index c5d814e5bd..c2bad4bdb6 100644
--- a/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegisterForm.tsx
+++ b/apps/erp/app/modules/quality/ui/RiskRegister/RiskRegisterForm.tsx
@@ -17,7 +17,7 @@ import {
} from "@carbon/react";
import { Editor } from "@carbon/react/Editor";
import { nanoid } from "nanoid";
-import { useEffect, useState } from "react";
+import { useState } from "react";
import { useFetcher } from "react-router";
import type { z } from "zod";
import {
@@ -99,16 +99,6 @@ const RiskRegisterForm = ({
return getPrivateUrl(result.data.path);
};
- useEffect(() => {
- // Only process the response when fetcher is idle (request complete)
- if (fetcher.data?.success === true) {
- toast.success(`Saved risk`);
- onClose();
- } else if (fetcher.state === "idle" && fetcher.data?.success === false) {
- toast.error(`Failed to save risk: ${fetcher.data?.error?.message}`);
- }
- }, [fetcher.data?.success, fetcher.data?.error, fetcher.state, onClose]);
-
const isEditing = !!initialValues.id;
const isDisabled = isEditing
? !permissions.can("update", "quality")
diff --git a/apps/erp/app/root.tsx b/apps/erp/app/root.tsx
index 78d400005b..6cc5ca3a7c 100644
--- a/apps/erp/app/root.tsx
+++ b/apps/erp/app/root.tsx
@@ -33,6 +33,7 @@ import {
ScrollRestoration,
useLoaderData
} from "react-router";
+import SonnerStyle from "sonner/dist/styles.css?url";
import { getMode, setMode } from "~/services/mode.server";
import Background from "~/styles/background.css?url";
import NProgress from "~/styles/nprogress.css?url";
@@ -45,7 +46,8 @@ export const links: LinksFunction = () => {
return [
{ rel: "stylesheet", href: Tailwind },
{ rel: "stylesheet", href: Background },
- { rel: "stylesheet", href: NProgress }
+ { rel: "stylesheet", href: NProgress },
+ { rel: "stylesheet", href: SonnerStyle }
];
};
diff --git a/apps/erp/app/routes/x+/quality+/risks.new.tsx b/apps/erp/app/routes/x+/quality+/risks.new.tsx
index a59f57382b..2f5268d81d 100644
--- a/apps/erp/app/routes/x+/quality+/risks.new.tsx
+++ b/apps/erp/app/routes/x+/quality+/risks.new.tsx
@@ -6,10 +6,11 @@ import { NotificationEvent } from "@carbon/notifications";
import { useDisclosure } from "@carbon/react";
import { tasks } from "@trigger.dev/sdk";
import type { ActionFunctionArgs } from "react-router";
-import { data } from "react-router";
+import { redirect } from "react-router";
import { riskRegisterValidator } from "~/modules/quality/quality.models";
import { upsertRisk } from "~/modules/quality/quality.service";
import RiskRegisterForm from "~/modules/quality/ui/RiskRegister/RiskRegisterForm";
+import { getParams, path } from "~/utils/path";
export const action = async ({ request }: ActionFunctionArgs) => {
const { client, userId, companyId } = await requirePermissions(request, {
@@ -38,12 +39,8 @@ export const action = async ({ request }: ActionFunctionArgs) => {
});
if (result.error) {
- return data(
- {
- data: null,
- success: false,
- error: result.error
- },
+ throw redirect(
+ path.to.risks,
await flash(request, error(result.error, "Failed to create risk"))
);
}
@@ -66,12 +63,8 @@ export const action = async ({ request }: ActionFunctionArgs) => {
}
}
- return data(
- {
- data: result.data,
- success: true,
- error: null
- },
+ throw redirect(
+ `${path.to.risks}?${getParams(request)}`,
await flash(request, success("Risk created successfully"))
);
};
diff --git a/package-lock.json b/package-lock.json
index 1f192135e3..d40f9be280 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -24768,11 +24768,13 @@
}
},
"node_modules/sonner": {
- "version": "1.4.41",
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz",
+ "integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==",
"license": "MIT",
"peerDependencies": {
- "react": "^18.0.0",
- "react-dom": "^18.0.0"
+ "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc",
+ "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc"
}
},
"node_modules/source-map": {
@@ -29451,7 +29453,7 @@
"react-hotkeys-hook": "~4.5.0",
"react-resizable-panels": "^2.1.3",
"react-shiki": "^0.9.1",
- "sonner": "1.4.41",
+ "sonner": "2.0.7",
"tailwind-merge": "^2.2.1",
"tailwindcss-animate": "^1.0.7"
},
@@ -29476,6 +29478,7 @@
"@internationalized/date": "^3.5.2",
"framer-motion": "^11.1.7",
"react": "^18.3.1",
+ "react-dom": "^18.3.1",
"react-icons": "^5.3.0"
}
},
diff --git a/packages/react/package.json b/packages/react/package.json
index 4c6894ff32..6814a69fd3 100644
--- a/packages/react/package.json
+++ b/packages/react/package.json
@@ -71,7 +71,7 @@
"react-hotkeys-hook": "~4.5.0",
"react-resizable-panels": "^2.1.3",
"react-shiki": "^0.9.1",
- "sonner": "1.4.41",
+ "sonner": "2.0.7",
"tailwind-merge": "^2.2.1",
"tailwindcss-animate": "^1.0.7"
},
@@ -108,6 +108,7 @@
"@internationalized/date": "^3.5.2",
"framer-motion": "^11.1.7",
"react": "^18.3.1",
+ "react-dom": "^18.3.1",
"react-icons": "^5.3.0"
},
"private": true,