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

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-11-24 22:01:53 +01:00
parent de5205040b
commit eb05e0ee33

View File

@@ -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,