Skip to content

feat(admin): Improve admin search dropdowns - #121498

Open
scttcper wants to merge 1 commit into
masterfrom
scttcper/admin-search
Open

feat(admin): Improve admin search dropdowns#121498
scttcper wants to merge 1 commit into
masterfrom
scttcper/admin-search

Conversation

@scttcper

@scttcper scttcper commented Aug 6, 2026

Copy link
Copy Markdown
Member

replaces gsAdmin's hand-rolled debounced search with Select and React Query and Select

organization search now respects the selected region and member ordering. user results show enough identity and account status to actually distinguish people.

arrow keys and enter work now

before

image

after

Screenshot 2026-08-06 at 4 08 32 PM

Replace the hand-rolled debounce search with typed React Query and the core Select component. Results now use fzf ordering, region-aware organization queries, and useful user details instead of the old bare rows.

Co-Authored-By: Codex <noreply@openai.com>
@scttcper
scttcper marked this pull request as ready for review August 6, 2026 23:10
@scttcper
scttcper requested a review from a team as a code owner August 6, 2026 23:10
Comment on lines +149 to +155
onChange={option => {
if (option.kind === 'query') {
onSearch?.(option.query);
} else {
onSelectResult(option.result);
}
}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The onChange handler in DebounceSearch does not check for a null option before accessing option.kind, which can cause a runtime error in edge cases where react-select passes null.
Severity: LOW

Suggested Fix

Add a null check at the beginning of the onChange handler to guard against a null option. For example: onChange={option => { if (!option) return; ... }}.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/gsAdmin/components/debounceSearch.tsx#L149-L155

Potential issue: The `onChange` handler for the `DebounceSearch` component receives an
`option` argument. According to the `react-select` library's API, this `option` can be
`null` in certain edge cases, such as when the menu closes without a selection. The
current implementation accesses `option.kind` without first checking if `option` is
`null`. This will lead to a `TypeError: Cannot read properties of null (reading
'kind')`, causing a runtime error and crashing the component. While the current UI
configuration makes this less likely to be triggered by direct user action, the risk
remains due to the component's lifecycle and internal state transitions.

Also affects:

  • actionNodeList.tsx
  • dataConditionNodeList.tsx

Did we get this right? 👍 / 👎 to inform future reviews.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 6, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7c3404d. Configure here.

inputValue={inputValue}
isLoading={isLoading}
isSearchable
openMenuOnClick={false}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dropdown cannot reopen after closing with text

Low Severity

Because onInputChange only reacts to input-change, the typed query stays in the field after the menu closes, but openMenuOnClick={false} means clicking or focusing the field again won't re-show the results. The user sees their query with no results and has to edit the text or press an arrow key to bring the list back.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7c3404d. Configure here.

} satisfies SearchOption<TResult>,
...resultOptions,
]
: resultOptions;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Empty query offers a blank search option

Low Severity

The synthetic search option is built unconditionally whenever onSearch is provided, including when normalizedInput is empty. After a user clears the field the menu stays open and shows a Search ... for "" entry that navigates to the list route with an empty query.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7c3404d. Configure here.

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

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant