Skip to content

dbeaver/pro#10365 Filter combobox items when custom values are allowed - #4685

Open
sergeyteleshev wants to merge 1 commit into
develfrom
dbeaver/pro#10365-ai-models-dropdown-search
Open

sergeyteleshev wants to merge 1 commit into
develfrom
dbeaver/pro#10365-ai-models-dropdown-search

Conversation

@sergeyteleshev

Copy link
Copy Markdown
Contributor

Closes dbeaver/pro#10365

Summary

  • Filter combobox items by input when allowCustomValue is enabled.
  • Hide the popover when no items match in custom-value mode.

Verification

  • Package build passed.
  • Package tests passed before removing the regression test as requested: 150 passed, 17 skipped.
  • Lint could not run: eslint is unavailable in the environment.
  • Dependency validation is blocked by process.stdout.clearLine in a non-TTY environment.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The updated filtering path can throw at runtime due to string-method calls on non-string values, and the disclosure can remain visible even when the popover is suppressed.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

This PR updates the core-blocks Combobox form control behavior in “custom value” mode so that item suggestions are filtered by the current input, and the suggestions popover is hidden when there are no matches.

Changes:

  • Remove the allowCustomValue short-circuit from item visibility so filtering applies in custom-value mode.
  • Suppress rendering the popover when allowCustomValue is enabled and the filtered list is empty.
File Description
webapp/​packages/​core-blocks/​src/​FormControls/​Combobox.tsx Applies filtering in custom-value mode and conditionally hides the popover when there are no matching items.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 120 to +124
const itemTitle = titleSelector?.(item);
const itemIcon = iconSelector?.(item);
const itemDisabled = isDisabled?.(item);

const isVisible =
allowCustomValue || inputValue === null || !inputValue.trim() || itemValue.toLowerCase().includes(inputValue.trim().toLowerCase());
const isVisible = inputValue === null || !inputValue.trim() || itemValue.toLowerCase().includes(inputValue.trim().toLowerCase());
Comment on lines 252 to +256
{displayPopover && <ComboboxDisclosure disabled={disabled || loading || readOnly} className="cb-combobox__disclosure-icon" />}
</>
)}
{icon && <div className="tw:absolute tw:left-3 tw:w-4 tw:h-4">{typeof icon === 'string' ? <IconOrImage icon={icon} /> : icon}</div>}
{displayPopover && (
{displayPopover && (!allowCustomValue || filteredItems.length > 0) && (
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.

3 participants