bug(CdkListbox): cdkOption requires additional event to rerender after list of options changed
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
When any **option was selected** in the list and than user filtered them somehow and back to the initial list, **that selected option** will be rendered incorrectly.
https://github.com/angular/components/assets/13451032/4392054a-68e3-439e-a250-0084c943d37d
P.S. A bit similar problem was there: https://github.com/angular/components/issues/28557
### Reproduction
StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-xvgkha?file=src%2Findex.html,src%2Fmain.ts
Steps to reproduce:
1. Click **"Ron"** option (it becomes true)
2. Type in `input` letter **"J"**
3. Remove letter **"J"**
4. See that option **"Ron"** is false.
5. Type in input letter **"R"** or click outside `input`
6. See that option **"Ron"** is true.
### Expected Behavior
Option should be rendered immediately based on its internal state (`isSelected()/isActive()`).
### Actual Behavior
Option requires one more event to be rendered based on its internal state (`isSelected()/isActive()`).
### Environment
- Angular: 17
- CDK/Material: 17.3.3
- Browser(s): Chrome and Safari
- Operating System (e.g. Windows, macOS, Ubuntu):
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với bản tái hiện StackBlitz được liên kết, đặc biệt là src/index.html và src/main.ts, rồi theo dõi các bước lọc đối với CdkListbox và cdkOption. So sánh trạng thái được render của tùy chọn đã chọn sau khi danh sách trở về nội dung ban đầu. Được xem là hoàn tất khi tùy chọn được render ngay lập tức từ trạng thái isSelected()/isActive() nội bộ của nó mà không cần thêm sự kiện nhập liệu hoặc tiêu điểm nào.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100