diff --git a/src/components/app-shell.tsx b/src/components/app-shell.tsx index a30ff9d..b4e1f07 100644 --- a/src/components/app-shell.tsx +++ b/src/components/app-shell.tsx @@ -71,7 +71,7 @@ export function AppShell({ children }: { children: ReactNode }) { if (data) setProfile({ full_name: data.full_name || "", avatar_url: (data as any).avatar_url ?? null }); }); const ch = supabase - .channel(`profile-self-${user.id}`) + .channel(`profile-self-${user.id}-${Math.random().toString(36).slice(2)}`) .on( "postgres_changes", { event: "UPDATE", schema: "public", table: "profiles", filter: `id=eq.${user.id}` }, diff --git a/src/components/cases/tasks-tab.tsx b/src/components/cases/tasks-tab.tsx index 30289fb..b01488a 100644 --- a/src/components/cases/tasks-tab.tsx +++ b/src/components/cases/tasks-tab.tsx @@ -72,7 +72,7 @@ export function CaseTasksTab({ caseId }: { caseId: string }) { useEffect(() => { load(); const ch = supabase - .channel(`case-tasks-${caseId}`) + .channel(`case-tasks-${caseId}-${Math.random().toString(36).slice(2)}`) .on("postgres_changes", { event: "*", schema: "public", table: "tasks", filter: `case_id=eq.${caseId}` }, () => load()) .on("postgres_changes", { event: "*", schema: "public", table: "task_assignees" }, () => load()) .subscribe(); diff --git a/src/components/comments/comment-thread.tsx b/src/components/comments/comment-thread.tsx index 67c3a73..446db21 100644 --- a/src/components/comments/comment-thread.tsx +++ b/src/components/comments/comment-thread.tsx @@ -72,7 +72,7 @@ export function CommentThread({ useEffect(() => { load(); const ch = supabase - .channel(`comments-${entityType}-${entityId}`) + .channel(`comments-${entityType}-${entityId}-${Math.random().toString(36).slice(2)}`) .on( "postgres_changes", { event: "*", schema: "public", table: "comments", filter: `entity_id=eq.${entityId}` }, diff --git a/src/components/notifications/notification-bell.tsx b/src/components/notifications/notification-bell.tsx index 796eeeb..8e025a8 100644 --- a/src/components/notifications/notification-bell.tsx +++ b/src/components/notifications/notification-bell.tsx @@ -48,7 +48,7 @@ export function NotificationBell() { if (!user) return; load(); const ch = supabase - .channel(`notif-${user.id}`) + .channel(`notif-${user.id}-${Math.random().toString(36).slice(2)}`) .on( "postgres_changes", { event: "*", schema: "public", table: "notifications", filter: `user_id=eq.${user.id}` }, diff --git a/src/components/tasks/task-detail-panel.tsx b/src/components/tasks/task-detail-panel.tsx index 0c65501..a99b006 100644 --- a/src/components/tasks/task-detail-panel.tsx +++ b/src/components/tasks/task-detail-panel.tsx @@ -153,7 +153,7 @@ export function TaskDetailPanel({ useEffect(() => { if (!open || !taskId) return; const ch = supabase - .channel(`task-${taskId}`) + .channel(`task-${taskId}-${Math.random().toString(36).slice(2)}`) .on("postgres_changes", { event: "*", schema: "public", table: "task_comments", filter: `task_id=eq.${taskId}` }, () => load()) .on("postgres_changes", { event: "*", schema: "public", table: "task_assignees", filter: `task_id=eq.${taskId}` }, () => load()) .on("postgres_changes", { event: "*", schema: "public", table: "tasks", filter: `id=eq.${taskId}` }, () => load()) diff --git a/src/lib/use-bubble-counts.ts b/src/lib/use-bubble-counts.ts index 641a58e..8b3719e 100644 --- a/src/lib/use-bubble-counts.ts +++ b/src/lib/use-bubble-counts.ts @@ -63,7 +63,7 @@ export function useBubbleCounts(): Counts { if (!user) return; load(); const ch = supabase - .channel(`bubbles-${user.id}`) + .channel(`bubbles-${user.id}-${Math.random().toString(36).slice(2)}`) .on("postgres_changes", { event: "*", schema: "public", table: "messages" }, () => load()) .on("postgres_changes", { event: "*", schema: "public", table: "task_assignees" }, () => load()) .on("postgres_changes", { event: "*", schema: "public", table: "tasks" }, () => load()) diff --git a/src/routes/messages.index.tsx b/src/routes/messages.index.tsx index abb7d26..757acbf 100644 --- a/src/routes/messages.index.tsx +++ b/src/routes/messages.index.tsx @@ -147,7 +147,7 @@ function MessagesPage() { useEffect(() => { if (!uid) return; const ch = supabase - .channel("messages-global") + .channel(`messages-global-${Math.random().toString(36).slice(2)}`) .on("postgres_changes", { event: "INSERT", schema: "public", table: "messages" }, () => { loadAll(); refreshUnread(); @@ -477,7 +477,7 @@ function ChatPanel({ // Realtime subscription scoped to this conversation useEffect(() => { const ch = supabase - .channel(`conv-${conversationId}`) + .channel(`conv-${conversationId}-${Math.random().toString(36).slice(2)}`) .on( "postgres_changes", { event: "*", schema: "public", table: "messages", filter: `conversation_id=eq.${conversationId}` }, diff --git a/src/routes/tasks.index.tsx b/src/routes/tasks.index.tsx index c0d1db8..38b4b13 100644 --- a/src/routes/tasks.index.tsx +++ b/src/routes/tasks.index.tsx @@ -105,7 +105,7 @@ function TasksPage() { useEffect(() => { load(); const ch = supabase - .channel("tasks-list") + .channel(`tasks-list-${Math.random().toString(36).slice(2)}`) .on("postgres_changes", { event: "*", schema: "public", table: "tasks" }, () => load()) .on("postgres_changes", { event: "*", schema: "public", table: "task_assignees" }, () => load()) .subscribe();