ant-design TreeSelect: the selected values are shuffled if they are not in the list items

9udxz4iz  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(65)

Steps to reproduce

The default values are "Expand to load 4", "Expand to load 5".

  1. Open the drop-down list
  2. Open the "Expand to load 1" element.
  3. The "Expand to load 4" element is loaded. The selected values will change the order, it will become: "Expand to load 5", "Expand to load 4". This is incorrect behavior
  4. Open "Expand to load 2".
  5. The "Expand to load 5" element is loaded. The selected values will change the order again

What is expected?

the selected values will not change the order, even if they are not in the drop-down list

What is actually happening?

the selected values change depending on their presence or absence in the drop-down list
| Environment | Info |
| ------------ | ------------ |
| antd | 5.19.3 |
| React | 18.2.0 |
| System | macos Monterey 12.5.1 |
| Browser | Google Chrome 126 |

cig3rfwq

cig3rfwq1#

I think I found a piece of code where this happens.
src/hooks/useCheckedKeys.ts

Сan you add a setting to this case?

oknwwptz

oknwwptz2#

It do not keep for perf consideration. But I think keeping the order seems more reasonable.

相关问题