Skip to content

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

Update useNotification to return undefined if swr faces an error

Joshen Lim5dc1d1a16bb5
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
index bdd18015adc..d29b63e6eea 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
@@ -20,7 +20,7 @@ const NotificationsPopover: FC<Props> = () => {
const [projectToRestart, setProjectToRestart] = useState<Project>()
const [targetNotification, setTargetNotification] = useState<Notification>()
- if (!notifications) return <div />
+ if (!notifications) return <></>
const hasNewNotifications = notifications?.some(
(notification) => notification.notification_status === NotificationStatus.New
diff --git a/studio/hooks/misc/useNotifications.tsx b/studio/hooks/misc/useNotifications.tsx
index 974bc388f9f..23b8f35d3dd 100644
--- a/studio/hooks/misc/useNotifications.tsx
+++ b/studio/hooks/misc/useNotifications.tsx
@@ -11,7 +11,7 @@ export const useNotifications = () => {
const refresh = () => mutate()
return {
- notifications: anyError ? [] : data,
+ notifications: anyError ? undefined : data,
isLoading: !anyError && !data,
isError: !!anyError,
refresh,