Skip to content

fix: allow spaces in the name filter#41788

Merged
7ttp merged 4 commits intomasterfrom
iat/allow-spaces-name-filter
Jan 28, 2026
Merged

fix: allow spaces in the name filter#41788
7ttp merged 4 commits intomasterfrom
iat/allow-spaces-name-filter

Conversation

@fadymak
Copy link
Contributor

@fadymak fadymak commented Jan 8, 2026

Allow for spaces in queries in the name filter. Previously they would be stripped on input change.

Screenshot 2026-01-08 at 13 22 12

Summary by CodeRabbit

  • New Features

    • Search component updated to manage query state internally and emit telemetry on submissions.
    • Column filter selection integrated into the search UI for clearer filtering.
  • Bug Fixes

    • Search input now preserves raw spacing while normalization (trim/lowercase) happens only on submit.
    • Validation improved to match selected filter column (IDs, phone prefixes, freeform/name/email).

✏️ Tip: You can customize this high-level summary in your review settings.

@fadymak fadymak requested a review from a team as a code owner January 8, 2026 12:23
@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
design-system Ready Ready Preview, Comment Jan 28, 2026 8:58am
docs Ready Ready Preview, Comment Jan 28, 2026 8:58am
studio-self-hosted Ready Ready Preview, Comment Jan 28, 2026 8:58am
studio-staging Ready Ready Preview, Comment Jan 28, 2026 8:58am
ui-library Ready Ready Preview, Comment Jan 28, 2026 8:58am
zone-www-dot-com Ready Ready Preview, Comment Jan 28, 2026 8:58am
2 Skipped Deployments
Project Deployment Review Updated (UTC)
cms Ignored Ignored Jan 28, 2026 8:58am
studio Ignored Ignored Jan 28, 2026 8:58am

Request Review

@supabase
Copy link

supabase bot commented Jan 8, 2026

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

Walkthrough

UsersSearch was rewritten to use internal query-state and telemetry. New props (telemetryProps, telemetryGroups, onSelectFilterColumn) replace external setters. Search input is stored raw and normalized only on submit; submissions emit an auth_users_search_submitted event via useSendEventMutation. Validation varies by selected column.

Changes

Cohort / File(s) Summary
UsersSearch component
apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx
Rewrote as controlled via internal query-state: added telemetryProps, telemetryGroups, onSelectFilterColumn; removed external setters (setSearch, setFilterKeywords, setSpecificFilterColumn). Input is stored raw, normalized on submit; emits auth_users_search_submitted with useSendEventMutation. Column-specific validation added.
Consumers / callers
apps/studio/components/interfaces/Auth/UsersV2.tsx
Removed local search state and direct setters passed to UsersSearch; now passes onSelectFilterColumn, telemetryProps, telemetryGroups, and relies on UsersSearch internal state/submit flow. Adjusted telemetry wiring accordingly.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant UsersV2
  participant UsersSearch
  participant TelemetryAPI

  User->>UsersSearch: Type search input (onChange stores raw)
  User->>UsersSearch: Submit search (Enter / click)
  UsersSearch->>UsersSearch: normalize (trim, toLowerCase) & validate by column
  UsersSearch->>UsersV2: onSelectFilterColumn (if column changed)
  UsersSearch->>TelemetryAPI: useSendEventMutation(auth_users_search_submitted { trigger, keywords, telemetryGroups })
  TelemetryAPI-->>UsersSearch: ack
  UsersSearch-->>User: show results / update UI
Loading

Possibly related PRs

Suggested reviewers

  • avallete
  • alaister
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. While it addresses the main change, it is missing several required sections from the template: confirmation of reading CONTRIBUTING.md, type of change classification, current behavior/issue link, and additional context. Complete the description by filling in all required template sections: confirm reading CONTRIBUTING.md, specify change type (bug fix), link the relevant issue, and provide additional context about the refactoring and telemetry changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: allow spaces in the name filter' directly addresses the main change: removing whitespace stripping from the name filter input, enabling spaces in search queries.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

🎭 Playwright Test Results

passed  84 passed
flaky  2 flaky
skipped  4 skipped

Details

stats  90 tests across 14 suites
duration  11 minutes, 52 seconds
commit  063d00b

Flaky tests

Features › index-advisor.spec.ts › Index Advisor › Enable Index Advisor › should enable Index Advisor via Database > Extensions page
Features › index-advisor.spec.ts › Index Advisor › Index Advisor Functionality › should create test table without indexes

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@fadymak fadymak enabled auto-merge (squash) January 8, 2026 12:38
@fadymak fadymak disabled auto-merge January 8, 2026 13:37
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx (1)

122-122: LGTM! The change correctly preserves spaces in search input.

Allowing spaces in the search input is appropriate for name searches. The implementation correctly maintains spaces during typing while still normalizing case.

However, there's a minor inconsistency with line 125: this line uses toLowerCase() while line 125 uses toLocaleLowerCase(). For consistency and locale-aware behavior, consider using the same method throughout.

♻️ Suggested consistency improvement
-        onChange={(e) => setSearch(e.target.value.toLowerCase())}
+        onChange={(e) => setSearch(e.target.value.toLocaleLowerCase())}

Note: Since search is now lowercased on input, the toLocaleLowerCase() call on line 125 becomes redundant, but keeping it doesn't cause issues and serves as defensive coding.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53f9bd4 and 0ac0d32.

📒 Files selected for processing (1)
  • apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx
🧰 Additional context used
📓 Path-based instructions (2)
apps/studio/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.{ts,tsx}: Assign complex conditions to descriptive variables instead of using multiple conditions in a single expression
Use consistent naming conventions for boolean variables: is prefix for state/identity, has prefix for possession, can prefix for capability/permission, should prefix for conditional behavior
Derive boolean state from existing state instead of storing it separately
Use early returns for guard clauses instead of deeply nested conditionals
Extract complex logic into custom hooks when logic becomes reusable or complex
Return objects from custom hooks instead of arrays for better extensibility and clearer API
Use discriminated unions for complex state management instead of multiple independent state fields
Avoid type casting (e.g., as any, as Type); instead validate values at runtime using zod schemas

Files:

  • apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx
apps/studio/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/studio-best-practices.mdc)

apps/studio/**/*.tsx: Components should ideally be under 200-300 lines; break down large components with multiple distinct UI sections, complex conditional rendering, or multiple unrelated useState hooks
Extract repeated JSX patterns into reusable components instead of copying similar JSX blocks
Use consistent loading/error/success pattern: handle loading state first with early returns, then error state, then empty state, then render success state
Keep state as local as possible and only lift up when needed
Group related state using objects or reducers instead of multiple useState calls, preferring react-hook-form for form state management
Name event handlers consistently: use on prefix for prop callbacks and handle prefix for internal handlers
Avoid inline arrow functions for expensive operations; use useCallback to maintain stable function references
Use appropriate conditional rendering patterns: && for simple show/hide, ternary for binary choice, early returns or extracted components for multiple conditions
Avoid nested ternaries in JSX; use separate conditions or early returns instead
Use useMemo for expensive computations when the computation is genuinely expensive and the value is passed to memoized children
Define prop interfaces explicitly for React components with proper typing of props and callback handlers

Files:

  • apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx
🧠 Learnings (3)
📚 Learning: 2025-12-11T17:04:40.037Z
Learnt from: CR
Repo: supabase/supabase PR: 0
File: .cursor/rules/studio-ui.mdc:0-0
Timestamp: 2025-12-11T17:04:40.037Z
Learning: Applies to apps/studio/components/**/*.{ts,tsx} : Use Input_Shadcn_ with type='password' for password input form fields

Applied to files:

  • apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx
📚 Learning: 2025-12-12T05:20:17.409Z
Learnt from: joshenlim
Repo: supabase/supabase PR: 41258
File: apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx:9-9
Timestamp: 2025-12-12T05:20:17.409Z
Learning: In apps/studio/**/*.{ts,tsx}, use named imports for DefaultLayout: import { DefaultLayout } from 'components/layouts/DefaultLayout' instead of default import. This is the new practice being adopted across the studio app.

Applied to files:

  • apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx
📚 Learning: 2026-01-02T05:58:55.226Z
Learnt from: meGauravJain
Repo: supabase/supabase PR: 41658
File: apps/studio/components/interfaces/Connect/content/prisma/content.tsx:70-85
Timestamp: 2026-01-02T05:58:55.226Z
Learning: In Prisma configuration or related connection setup code, prefer the environment variable name DIRECT_URL for direct/non-pooled database connections instead of DATABASE_URL_UNPOOLED, per Prisma documentation. Update code that reads database connection strings to use DIRECT_URL where applicable, and document why this is preferred (explicit, documented behavior). Ensure your environment provides DIRECT_URL when using direct connections and fallback handling if needed.

Applied to files:

  • apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test (1)
  • GitHub Check: test
  • GitHub Check: typecheck

@coveralls
Copy link

Coverage Status

coverage: 66.74%. remained the same
when pulling 063d00b on iat/allow-spaces-name-filter
into dc31696 on master.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx`:
- Around line 52-75: UsersSearch initializes local state variable search from
filterKeywords but never updates it on query-state changes; add a useEffect
inside UsersSearch that watches filterKeywords and calls
setSearch(filterKeywords) (only when filterKeywords !== search) so the input
stays in sync with URL query changes (ensure the effect lists filterKeywords and
search or uses a safe comparison to avoid an infinite loop).

Comment on lines 52 to +75
export const UsersSearch = ({
search,
searchInvalid,
specificFilterColumn,
setSearch,
setFilterKeywords,
setSpecificFilterColumn,
improvedSearchEnabled = false,
telemetryProps,
telemetryGroups,
onSelectFilterColumn,
}: UsersSearchProps) => {
const [_, setSelectedId] = useQueryState(
'show',
parseAsString.withOptions({ history: 'push', clearOnDefault: true })
)
const [filterKeywords, setFilterKeywords] = useQueryState('keywords', { defaultValue: '' })
const [specificFilterColumn] = useQueryState<SpecificFilterColumn>(
'filter',
parseAsStringEnum<SpecificFilterColumn>([
'id',
'email',
'phone',
'name',
'freeform',
]).withDefault('email')
)

const [search, setSearch] = useState(filterKeywords)
const { mutate: sendEvent } = useSendEventMutation()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Sync local search when the query param changes.

search is initialized from filterKeywords but never updated if the query-state changes (e.g., back/forward navigation or external updates), which can leave the input stale.

🔧 Suggested fix
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
...
 const [search, setSearch] = useState(filterKeywords)
+
+useEffect(() => {
+  setSearch(filterKeywords)
+}, [filterKeywords])
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const UsersSearch = ({
search,
searchInvalid,
specificFilterColumn,
setSearch,
setFilterKeywords,
setSpecificFilterColumn,
improvedSearchEnabled = false,
telemetryProps,
telemetryGroups,
onSelectFilterColumn,
}: UsersSearchProps) => {
const [_, setSelectedId] = useQueryState(
'show',
parseAsString.withOptions({ history: 'push', clearOnDefault: true })
)
const [filterKeywords, setFilterKeywords] = useQueryState('keywords', { defaultValue: '' })
const [specificFilterColumn] = useQueryState<SpecificFilterColumn>(
'filter',
parseAsStringEnum<SpecificFilterColumn>([
'id',
'email',
'phone',
'name',
'freeform',
]).withDefault('email')
)
const [search, setSearch] = useState(filterKeywords)
const { mutate: sendEvent } = useSendEventMutation()
import { useEffect, useState } from 'react'
export const UsersSearch = ({
improvedSearchEnabled = false,
telemetryProps,
telemetryGroups,
onSelectFilterColumn,
}: UsersSearchProps) => {
const [_, setSelectedId] = useQueryState(
'show',
parseAsString.withOptions({ history: 'push', clearOnDefault: true })
)
const [filterKeywords, setFilterKeywords] = useQueryState('keywords', { defaultValue: '' })
const [specificFilterColumn] = useQueryState<SpecificFilterColumn>(
'filter',
parseAsStringEnum<SpecificFilterColumn>([
'id',
'email',
'phone',
'name',
'freeform',
]).withDefault('email')
)
const [search, setSearch] = useState(filterKeywords)
useEffect(() => {
setSearch(filterKeywords)
}, [filterKeywords])
const { mutate: sendEvent } = useSendEventMutation()
🤖 Prompt for AI Agents
In `@apps/studio/components/interfaces/Auth/Users/UsersSearch.tsx` around lines 52
- 75, UsersSearch initializes local state variable search from filterKeywords
but never updates it on query-state changes; add a useEffect inside UsersSearch
that watches filterKeywords and calls setSearch(filterKeywords) (only when
filterKeywords !== search) so the input stays in sync with URL query changes
(ensure the effect lists filterKeywords and search or uses a safe comparison to
avoid an infinite loop).

Copy link
Member

@joshenlim joshenlim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified changes preview and locally

@7ttp 7ttp merged commit 8d93e98 into master Jan 28, 2026
25 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

Braintrust eval report

Assistant (master-1769592469)

Score Average Improvements Regressions
Completeness 100% (+13pp) 1 🟢 -
Conciseness 0% (+0pp) - -
Goal Completion 94.4% (-6pp) - -
Tool Usage 100% (+0pp) - -
Correctness 100% (+33pp) 1 🟢 -
Docs Faithfulness 62.5% (-12pp) - 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Time_to_first_token 0.18tok (+0.03tok) 1 🟢 8 🔴
Llm_calls 8.56 (+0.22) 2 🟢 1 🔴
Tool_calls 3.56 (+0.22) 2 🟢 1 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 102696.22tok (+1968.89tok) 5 🟢 4 🔴
Prompt_cached_tokens 56291.56tok (+654.22tok) 4 🟢 4 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 5620.44tok (+935.56tok) 3 🟢 6 🔴
Completion_reasoning_tokens 4110.22tok (+711.11tok) 3 🟢 6 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 108316.67tok (+2904.44tok) 4 🟢 5 🔴
Estimated_cost 0.02$ (+0$) 3 🟢 6 🔴
Duration 48.77s (+11.06s) 2 🟢 7 🔴
Llm_duration 96.77s (+22.58s) 2 🟢 7 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants