fix(studio): make organization search case-insensitive (#53526)

## Problem

The search on the organizations page lowercased each organization's name
and slug but compared them with the raw input. Any search term with an
uppercase letter matched nothing, and leading or trailing spaces broke
matches too.

## Solution

Normalize the input once (`search.trim().toLowerCase()`) and use it for
the filter and for the empty-state check. A whitespace-only search now
counts as no filter, and the no-results message shows the trimmed term.

## Review instructions

1. Sign in to the preview with an account that has at least one
organization and open `/dashboard/organizations`.
2. Type an organization's name in a different case (for example all
uppercase). The organization still shows.
3. Type part of an organization's slug in uppercase. The organization
still shows.
4. Add spaces before and after a matching term. The organization still
shows.
5. Type only spaces. Every organization shows, and the no-results state
does not appear.
6. Type a term that matches no organization. The no-results state
appears.

Checks run: `pnpm turbo run typecheck --filter='...[origin/master]'`
(pass), `eslint` on the changed file (pass), Prettier check (pass).
`pnpm turbo run lint` ran out of memory twice in the
`studio#lint:type-checks` step.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)


[FE-5119](https://linear.app/supabase/issue/FE-5119/organization-search-on-the-organizations-page-is-case-sensitive)

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
This commit is contained in:
supabase-vercel-tedd[bot] authored and GitHub committed 2026-11-17 14:48:00 +00:00
1 parent 6d2cf769a5
commit 943f02f413
1 file changed
+6 -4
+6 -4
View File
@@ -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 && <NoOrganizationsState />}
{search.length > 0 && filteredOrganizations.length === 0 && (
<NoSearchResults searchString={search} />
{searchTerm.length > 0 && filteredOrganizations.length === 0 && (
<NoSearchResults searchString={search.trim()} />
)}
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">