Repository navigation
fix(Slider): handle empty range values - #4425
Merged
Merged
Conversation
dvd233
requested review from
HaixingOoO,
NWYLZW,
RylanBot,
ZWkang,
carolin913,
honkinglin and
uyarn
as code owners
October 14, 2026 06:10
Collaborator
TDesign Component Site Preview Open
|
commit: |
RylanBot
force-pushed
the
fix/slider-empty-range
branch
from
October 19, 2026 04:33
f1cf9ac to
3af37b9
Compare
RylanBot
approved these changes
Oct 19, 2026
Merged
5 of 16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤔 这个 PR 的性质是?
🔗 相关 Issue
Fixes #2618
💡 需求背景和解决方案
双游标 Slider 在 value 为 undefined、空数组,或未提供初值时,拖动可能返回标量或缺少端点的数组。空范围现在使用当前 min 补齐两个端点,渲染、边界判断和 onChange 去重共用该有效值;内部默认的 0 在范围有效时仍保留。重合端点按轨道或 marks 点击方向选择可移动的一端。
显式 numeric value/defaultValue 保持标量回调,正常 pair 的中点选择及受控行为保持原契约。使用初始 defaultValue 的来源,避免后续修改该 prop 重新解释已初始化状态。不改生成的 API 类型、默认属性或共享 useControlled。
本地验证:
使用 Codex 辅助调查、实现和验证。
📷 交互对照
基线:undefined 返回标量;空数组的拖动回调出现空位。
修复后:先拖右端得到 [0, 70],再拖左端得到 [25, 70]。
验证说明与截图来源。截图中的 fixed 包构建早于本地提交,源码哈希与本 PR 提交一致。
📝 更新日志
tdesign-react
range但传入空范围值时,无法正确交互的问题☑️ 请求合并前的自查清单