diff --git a/apps/studio/routes/_app/organizations.tsx b/apps/studio/routes/_app/organizations.tsx index 7fedfd51686..254e133897e 100644 --- a/apps/studio/routes/_app/organizations.tsx +++ b/apps/studio/routes/_app/organizations.tsx @@ -49,11 +49,13 @@ function OrganizationsPage() { } = useOrganizationsQuery() const organizationCreationEnabled = useIsFeatureEnabled('organizations:create') + const searchTerm = search.trim().toLowerCase() const filteredOrganizations = - search.length === 0 + searchTerm.length === 0 ? organizations : organizations?.filter( - (x) => x.name.toLowerCase().includes(search) || x.slug.toLowerCase().includes(search) + (x) => + x.name.toLowerCase().includes(searchTerm) || x.slug.toLowerCase().includes(searchTerm) ) return ( @@ -83,8 +85,8 @@ function OrganizationsPage() { {isSuccess && organizations.length === 0 && !isError && } - {search.length > 0 && filteredOrganizations.length === 0 && ( - + {searchTerm.length > 0 && filteredOrganizations.length === 0 && ( + )}