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: re-render notifications when company changes

Brad Barbin35271b950fb8
diff --git a/apps/erp/app/components/Layout/Topbar/Topbar.tsx b/apps/erp/app/components/Layout/Topbar/Topbar.tsx
index 7e199afa11..49d6fbdf45 100644
--- a/apps/erp/app/components/Layout/Topbar/Topbar.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Topbar.tsx
@@ -1,5 +1,5 @@
import { HStack } from "@carbon/react";
-import { usePermissions } from "~/hooks";
+import { usePermissions, useUser } from "~/hooks";
import AvatarMenu from "../../AvatarMenu";
import Breadcrumbs from "./Breadcrumbs";
import CreateMenu from "./CreateMenu";
@@ -9,6 +9,8 @@ import Search from "./Search";
const Topbar = () => {
const permissions = usePermissions();
+ const user = useUser();
+ const notificationsKey = `${user.id}:${user.company.id}`;
return (
<div className="flex bg-background text-foreground border-b border-border px-4 top-0 sticky z-10 space-x-4 justify-between items-center">
@@ -18,7 +20,7 @@ const Topbar = () => {
{permissions.is("employee") ? <Search /> : <div />}
<Feedback />
<CreateMenu />
- <Notifications />
+ <Notifications key={notificationsKey} />
<AvatarMenu />
</HStack>
</div>