Skip to content

fix: avoid duplicate search tags for grouped options - #1255

Open
dvd233 wants to merge 1 commit into
react-component:masterfrom
dvd233:codex/tags-group-search
Open

dvd233 wants to merge 1 commit into
react-component:masterfrom
dvd233:codex/tags-group-search

Conversation

@dvd233

@dvd233 dvd233 commented Oct 10, 2026 •

Copy link
Copy Markdown

In tags mode, searching for an exact match inside an option group adds a second temporary option because the search checks only top-level options. Apply the existing value and filter-field checks to group children while preserving group matches, custom field names, and disabled-option handling.

Closes #795.

Validation:

  • Added 13 regression/control cases. The six bug cases fail on the unmodified base with two rows instead of one.
  • Full rc-test --runInBand --coverage: 21 suites, 456 tests, and 21 snapshots passed.
  • pnpm run lint: 0 errors, 38 warnings. pnpm run compile: ESM, CJS, declarations, and Less passed.
  • 13 real Chromium scenarios with React 18.3.1 passed, including grouped/legacy options, custom fields, free text, label/value differences, and disabled options.

pnpm run tsc reports seven existing Jest matcher-alias type errors. The same seven errors occur on the unmodified base under the identical dependency lock; the library declaration build above passes.

Summary by CodeRabbit

  • 问题修复
    • 标签模式下,搜索值匹配分组选项的父级或子项时,会选择已有选项,不再创建重复的临时标签。
    • 自定义过滤隐藏分组选项时,仍可通过 Enter 选择未禁用项;禁用项不会触发选择变更。
  • 测试
    • 补充分组标签模式下的匹配、过滤与键盘选择测试。

@vercel

vercel Bot commented Oct 10, 2026

Copy link
Copy Markdown

@dvd233 is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3ce89c39-7ace-449d-a1a2-457cf0934261

📥 Commits

Reviewing files that changed from the base of the PR and between 59dd34a and 8d7a583.


📒 Files selected for processing (2)
  • src/Select.tsx
  • tests/Tags.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.



Walkthrough

Select 的标签模式现在使用配置的值字段匹配搜索内容,并检查分组选项及其子项。新增测试覆盖匹配选择、搜索标签显示和过滤后的 Enter 选择。

Changes

标签模式分组选项匹配

Layer / File(s) Summary
分组选项匹配与测试
src/Select.tsx, tests/Tags.test.tsx
匹配逻辑改为比较配置的值字段,并检查分组选项及其子项。测试覆盖多种选项配置、搜索文本、过滤字段及过滤后的 Enter 选择。

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: qdyanbing

Merge Risk: ⚪ Minimal · up to 8d7a5

In tags mode, typing an exact match for an option inside a group should no longer add a duplicate temporary row. No merge-blocking risk was identified.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题准确概括了主要变更:修复分组选项在 tags 模式下生成重复搜索标签的问题。表述简洁、明确,并与代码和测试变更一致。
Linked Issues check Passed 直接关联的开放 issue #795 要求 tags 模式在 OptGroup 子项值与搜索值完全相同时,不显示重复的临时选项。src/Select.tsx 现在检查 mergedFieldNames.value、配置的 optionFilterProp,并递归检查分组的 mergedFieldNames.options 子项。匹配父级或子项时,代码返回现有过滤结果,不创建临时选项…
Out of Scope Changes check Passed 变更集中在 src/Select.tsx 的 tags 模式临时选项判断,以及 tests/Tags.test.tsx 的相关回归和控制测试。分组子项、值字段、optionFilterProp 和禁用选项处理都直接支持 issue #795 的目标。没有证据表明存在与该目标无关的源代码或测试变更。
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

This branch has not been deployed

No deployments
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.

<Select /> with OptGroup in "tags" mode dropdown values display issue

1 participant