Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Refresh notifications after closing popover

Joshen Lim3770d12cdc0d
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
index f95bda2e51d..d4a10e97030 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
@@ -15,7 +15,7 @@ interface Props {}
const NotificationsPopover: FC<Props> = () => {
const router = useRouter()
const { app, ui } = useStore()
- const { notifications } = useNotifications()
+ const { notifications, refresh } = useNotifications()
const [projectToRestart, setProjectToRestart] = useState<Project>()
const [targetNotification, setTargetNotification] = useState<Notification>()
@@ -33,8 +33,9 @@ const NotificationsPopover: FC<Props> = () => {
?.filter((notification) => notification.notification_status === NotificationStatus.New)
.map((notification) => notification.id)
if (notificationIds.length > 0) {
- const { data, error } = await patch(`${API_URL}/notifications`, { ids: notificationIds })
- console.log(data, error)
+ const { error } = await patch(`${API_URL}/notifications`, { ids: notificationIds })
+ if (error) console.error('Failed to update notifications', error)
+ refresh()
}
}
}