Skip to content

fix(select): preserve object search callback pipeline - #9711

Merged
chenshuai2144 merged 1 commit into
ant-design:masterfrom
nrps9909:codex/fix-search-select-object-callbacks
Oct 2, 2026
Merged

chenshuai2144 merged 1 commit into
ant-design:masterfrom
nrps9909:codex/fix-search-select-object-callbacks

Conversation

@nrps9909

@nrps9909 nrps9909 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

When SearchSelect receives showSearch={{ onSearch }}, rc-select gives the object callback precedence over the top-level callback. This skips ProComponents' wrapper: typing calls the consumer callback but never forwards the keyword to request or updates ProComponents' search state. searchOnFocus also still calls the deprecated top-level callback instead of the resolved object callback.

Compose the existing search handler into the object configuration and reuse the resolved callback for focus resets. Boolean search behavior and fetchDataOnSearch={false} remain covered by controls. This is a remaining callback-composition bug after #9680, separate from the superseded #9689 feature-support patch and #9706's top-level prop feature.

Validation on signed/GitHub-Verified head e2aecd9510cb75e4710be7d9ccb3a0ef641696d3, based on current master 67ed7d4c37595bd1cd5c0709aff95d1531b7b486 (Node 26.10.0 / pnpm 9.15.9 / Vitest 4.1.11):

  • Before the fix: 2 regressions fail (missing keyword request and incorrect focus callback), 3 controls pass.
  • After the fix: all 5 new cases pass, including callback-once during typing and disabled remote fetching.
  • Full pnpm test: 122 files / 1,386 tests pass.
  • pnpm tsc, focused ESLint/Prettier, git diff --check, and full pnpm build (UMD, ES/CJS and declarations): pass.

AI assistance: Codex helped reproduce the two failures, implement the callback composition, run validation, and prepare this PR. New-head upstream CI is separate from these local results.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 9db1be08-dc72-4b15-b548-eab72099680c

📥 Commits

Reviewing files that changed from the base of the PR and between 67ed7d4 and e2aecd9.

📒 Files selected for processing (2)
  • src/field/components/Select/SearchSelect/index.tsx
  • tests/form/searchSelectObject.test.tsx

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


📝 Walkthrough

Walkthrough

SearchSelect 将请求、搜索回调和搜索值更新集中到统一处理器,并调整对象形式 showSearch 的回调接入方式。新增测试覆盖请求条件和聚焦时的搜索重置行为。

Changes

SearchSelect 搜索处理

Layer / File(s) Summary
统一搜索回调与请求处理
src/field/components/Select/SearchSelect/index.tsx, tests/form/searchSelectObject.test.tsx
新增统一处理器,根据 fetchDataOnSearch 决定是否请求数据,并调用有效搜索回调、更新搜索值。对象形式的 showSearch 保留配置并使用该处理器。测试覆盖请求条件,以及聚焦时回调收到空字符串、请求收到 undefined 的情况。

Priority: ➖ Normal

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

Change: Bug fix

Suggested reviewers: chenshuai2144

Merge Risk: ⚪ Minimal · up to e2aec

The change restores object-form search callbacks to the request pipeline while preserving disabled-fetch behavior and aligning focus resets. No actionable merge-blocking risk is identified; merge after normal checks pass.

Security Architecture Review

Security architecture risk: 🔵 Low · up to e2aec

The change restores search behavior using the application's existing request callback. The remote-fetch setting and callback precedence remain enforced, and no new privileged access or security-control bypass was identified. Authorization within application-specific request handlers was not assessed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed reachability is typed input reaching the existing application-supplied request handler for object-form search configurations. Effective service, tenant and data exposure depends on that handler; the inspected component does not establish those downstream scopes.

Trust Boundaries and Controls

  • observed — The inspected path forwards the keyword without adding credentials or changing identity context. Request authority remains with the caller-provided function, and the adapter preserves the field-level fetchDataOnSearch override.

Resilience and Maintainability Implications

  • observed — The handler preserves the base synchronous ordering and introduces no atomicity, cancellation or exception boundary. Request state remains managed through the existing debounced SWR key and reset function. Cancellation, stale-response behavior and recovery inside downstream request implementations were not verified.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:修复 SearchSelect 在对象形式 showSearch 下保留并组合搜索回调链路的问题。标题简洁、明确,并与代码和测试变更一致。
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.14%. Comparing base (67ed7d4) to head (e2aecd9).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9711   +/-   ##
=======================================
  Coverage   88.14%   88.14%           
=======================================
  Files         422      422           
  Lines       12161    12161           
  Branches     4461     4463    +2     
=======================================
  Hits        10719    10719           
  Misses       1284     1284           
  Partials      158      158           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chenshuai2144
chenshuai2144 merged commit 5da0133 into ant-design:master Oct 2, 2026
9 of 10 checks passed
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.

2 participants