Skip to content

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

Fix error handling logic in use Notification hook

Joshen Limf86e425e6ec4
diff --git a/studio/hooks/misc/useNotifications.tsx b/studio/hooks/misc/useNotifications.tsx
index f0e817306c3..974bc388f9f 100644
--- a/studio/hooks/misc/useNotifications.tsx
+++ b/studio/hooks/misc/useNotifications.tsx
@@ -6,11 +6,12 @@ import { API_URL } from 'lib/constants'
export const useNotifications = () => {
const { data, error, mutate } = useSWR<Notification[]>(`${API_URL}/notifications`, get)
- const anyError = error !== undefined
+
+ const anyError = (data as any)?.error || error !== undefined
const refresh = () => mutate()
return {
- notifications: anyError ? undefined : data,
+ notifications: anyError ? [] : data,
isLoading: !anyError && !data,
isError: !!anyError,
refresh,