Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix(dashboard): do not listen to notifications if projectid is missing

Carl-Gerhard Lindesvärdeb05e0ee3339
diff --git a/apps/dashboard/src/components/notifications/notification-provider.tsx b/apps/dashboard/src/components/notifications/notification-provider.tsx
index 1e1258935..0824ab352 100644
--- a/apps/dashboard/src/components/notifications/notification-provider.tsx
+++ b/apps/dashboard/src/components/notifications/notification-provider.tsx
@@ -6,6 +6,15 @@ import { toast } from 'sonner';
export function NotificationProvider() {
const { projectId } = useAppParams();
+
+ if (!projectId) return null;
+
+ return <InnerNotificationProvider projectId={projectId} />;
+}
+
+export function InnerNotificationProvider({
+ projectId,
+}: { projectId: string }) {
useWS<Notification>(`/live/notifications/${projectId}`, (notification) => {
toast(notification.title, {
description: notification.message,