Skip to content

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

Update

Joshen Lim4957b33f5838
diff --git a/studio/components/interfaces/Home/ProjectList/ProjectList.tsx b/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
index 14b0dcb0577..e4ee9880f3e 100644
--- a/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
+++ b/studio/components/interfaces/Home/ProjectList/ProjectList.tsx
@@ -15,7 +15,7 @@ import { useProjectsQuery } from 'data/projects/projects-query'
import { useCheckPermissions } from 'hooks'
import { IS_PLATFORM } from 'lib/constants'
import { makeRandomString } from 'lib/helpers'
-import { Organization, Project } from 'types'
+import { Organization, Project, ResponseError } from 'types'
import ProjectCard from './ProjectCard'
import ShimmeringCard from './ShimmeringCard'
@@ -25,9 +25,20 @@ export interface ProjectListProps {
const ProjectList = ({ rewriteHref }: ProjectListProps) => {
const { data: organizations } = useOrganizationsQuery()
- const { data: allProjects } = useProjectsQuery()
+ const {
+ data: allProjects,
+ isLoading: isLoadingProjects,
+ isError: isErrorProjects,
+ error: projectsError,
+ } = useProjectsQuery()
+ const {
+ isLoading: _isLoadingPermissions,
+ isError: isErrorPermissions,
+ error: permissionsError,
+ } = usePermissionsQuery()
const { data: allOverdueInvoices } = useOverdueInvoicesQuery({ enabled: IS_PLATFORM })
const projectsByOrg = groupBy(allProjects, 'organization_id')
+ const isLoadingPermissions = IS_PLATFORM ? _isLoadingPermissions : false
return (
<>
@@ -41,6 +52,12 @@ const ProjectList = ({ rewriteHref }: ProjectListProps) => {
(it) => it.organization_id === organization.id
)}
rewriteHref={rewriteHref}
+ isLoadingPermissions={isLoadingPermissions}
+ isErrorPermissions={isErrorPermissions}
+ permissionsError={permissionsError}
+ isLoadingProjects={isLoadingProjects}
+ isErrorProjects={isErrorProjects}
+ projectsError={projectsError}
/>
)
})}
@@ -54,6 +71,12 @@ type OrganizationProjectsProps = {
organization: Organization
projects: Project[]
overdueInvoices: OverdueInvoicesResponse[]
+ isLoadingPermissions: boolean
+ isErrorPermissions: boolean
+ permissionsError: ResponseError | null
+ isLoadingProjects: boolean
+ isErrorProjects: boolean
+ projectsError: ResponseError | null
rewriteHref?: (projectRef: string) => string
}
@@ -61,23 +84,17 @@ const OrganizationProjects = ({
organization: { id, name, slug, subscription_id },
projects,
overdueInvoices,
+ isLoadingPermissions,
+ isErrorPermissions,
+ permissionsError,
+ isLoadingProjects,
+ isErrorProjects,
+ projectsError,
rewriteHref,
}: OrganizationProjectsProps) => {
const isEmpty = !projects || projects.length === 0
const canReadProjects = useCheckPermissions(PermissionAction.READ, 'projects', undefined, id)
- const {
- isLoading: isLoadingProjects,
- isError: isErrorProjects,
- error: projectsError,
- } = useProjectsQuery()
- const {
- isLoading: _isLoadingPermissions,
- isError: isErrorPermissions,
- error: permissionsError,
- } = usePermissionsQuery()
- const isLoadingPermissions = IS_PLATFORM ? _isLoadingPermissions : false
-
return (
<div className="space-y-3" key={makeRandomString(5)}>
<div className="flex space-x-4 items-center">
diff --git a/studio/components/ui/AlertError.tsx b/studio/components/ui/AlertError.tsx
index 7bc950b7484..b8a8a614d9f 100644
--- a/studio/components/ui/AlertError.tsx
+++ b/studio/components/ui/AlertError.tsx
@@ -5,7 +5,7 @@ import { Alert, Button } from 'ui'
export interface AlertErrorProps {
ref?: string
subject?: string
- error?: ResponseError
+ error?: ResponseError | null
}
// [Joshen] To standardize the language for all error UIs