The short version
Interpolating a raw search term into a PostgREST .or() filter via a template literal breaks the filter grammar on a reserved character like a comma. On top of that, supabase-js doesn't throw on a transport or PostgREST failure β it represents it as a {data: null, error} return value β so the moment the caller reads .data ?? [] , a broken filter that turns data into null gets treated as an empty array with no exception and no log. Global search's contacts query broke exactly this way. The fix was to split name and email into separate parameterized .ilike() calls and merge the results in JS.
The state it could become
The subject is global search in kimiteras-portal β the source behind both search and the command palette. It queries companies, contacts, projects, contracts, schools, tasks, and documents in one Promise.all round trip. Contacts alone need to match on both name and email, and before the fix it was written like this:
supabase . from ( " contacts " ) .β¦