Skip to content

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

fix: improve route validation checks

phamhieua3d1842facae
diff --git a/studio/components/interfaces/App/RouteValidationWrapper.tsx b/studio/components/interfaces/App/RouteValidationWrapper.tsx
index 5dbc8420ccc..a9c35f14893 100644
--- a/studio/components/interfaces/App/RouteValidationWrapper.tsx
+++ b/studio/components/interfaces/App/RouteValidationWrapper.tsx
@@ -19,8 +19,7 @@ const RouteValidationWrapper: FC = ({ children }) => {
if (orgsInitialized && orgSlug) {
// Check validity of organization that user is trying to access
const organizations = app.organizations.list()
- const organizationSlugs = organizations.map((org: Organization) => org.slug)
- const isValidOrg = organizationSlugs.includes(orgSlug as string)
+ const isValidOrg = organizations.some((org: Organization) => org.slug === orgSlug)
if (!isValidOrg) {
ui.setNotification({ category: 'error', message: 'This organization does not exist' })
@@ -34,8 +33,7 @@ const RouteValidationWrapper: FC = ({ children }) => {
if (projectsInitialized && projectRef) {
// Check validity of project that the user is trying to access
const projects = app.projects.list()
- const projectRefs = projects.map((project: Project) => project.ref)
- const isValidProject = projectRefs.includes(projectRef as string)
+ const isValidProject = projects.some((project: Project) => project.ref === projectRef)
if (!isValidProject) {
ui.setNotification({ category: 'error', message: 'This project does not exist' })