Value property must be unique / incorrect option passed to onSelect
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu với CodeSandbox được liên kết tại src/App.js và tái hiện chuỗi lựa chọn, sau đó theo dõi cách value và key được sử dụng trước khi onSelect nhận một tùy chọn. Hoàn tất khi việc chọn các mục có value trùng lặp truyền các tùy chọn tương ứng kèm key của chúng, bao gồm cả trường hợp id1, id2 và id3 được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Demo:
https://codesandbox.io/s/exciting-bird-x7m1kf?file=/src/App.js
Steps to reproduce:
- Click to input, dropdown opens;
- Click on first option;
- Click to input again;
- Click on second option;
- Observe console output
Expected behavior:
After first click, option with 'key: "id1"' should be passed to onSelect. After second click, option with 'key: "id2"' should be passed to onSelect
Actual behavior:
Same option is passed to onSelect (id3) regardless which option I select.
Comment:
It's not stated anywhere that value prop must be unique, which in many cases is not satisfying - movies, companies, books etc. can have same name but unique ID. In my case, same values might have highlighted different parts of string - I can not use options prop. I also can not pass id to value, since I need backfill.
One possible solution would be to keep uniqueness only to keys. Other (which will solve only my case) to do backfill with different prop - title, label or something else and fill it with value as a backup.
- Ngôn ngữ chính
- TypeScript
- Star
- 938
- Fork
- 482
- Merge trung bình
- 15 giờ 8 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react-component/select
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
react-component/select#1216 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
react-component/select#1159 ·
-
a11y 问题Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
react-component/select#1087 · 1 reaction ·
-
showSearch 默认值是 false 把Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
react-component/select#1086 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
react-component/select#1082 · 1 bình luận ·
Tất cả issue của react-component/select
Issue tương tự
-
Mend: dependency security vulnerability untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opensearch-project/security-dashboards-plugin#2545 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Dream TR SDĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
doctor integrity sample scans soft-deleted pages on Postgres (batch path has no deleted_at filter)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
SocialGouv/egapro#4672 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:agents area:tui bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
anthropics/claude-code#98358 ·
Maintainer thường phản hồi trong vòng 1 ngày