fix(dashboard): do not listen to notifications if projectid is missing
This commit is contained in:
@@ -6,6 +6,15 @@ import { toast } from 'sonner';
|
|||||||
|
|
||||||
export function NotificationProvider() {
|
export function NotificationProvider() {
|
||||||
const { projectId } = useAppParams();
|
const { projectId } = useAppParams();
|
||||||
|
|
||||||
|
if (!projectId) return null;
|
||||||
|
|
||||||
|
return <InnerNotificationProvider projectId={projectId} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function InnerNotificationProvider({
|
||||||
|
projectId,
|
||||||
|
}: { projectId: string }) {
|
||||||
useWS<Notification>(`/live/notifications/${projectId}`, (notification) => {
|
useWS<Notification>(`/live/notifications/${projectId}`, (notification) => {
|
||||||
toast(notification.title, {
|
toast(notification.title, {
|
||||||
description: notification.message,
|
description: notification.message,
|
||||||
|
|||||||
Reference in New Issue
Block a user