fix(select): keep the active option when options are appended - #1847
fix(select): keep the active option when options are appended#1847lskramarov wants to merge 2 commits into
Conversation
|
Visit the preview URL for this PR (updated for commit a2f3870): https://koobiq-next--prs-1847-hsycrq0f.web.app (expires Sat, 08 Aug 2026 13:40:43 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c |
🚨 E2E tests failedReview the report for details. 💡 Comment |
2c5f91f to
99083fb
Compare
| @case ('success') { | ||
| @for (option of state.data; track option.id) { | ||
| <kbq-option [value]="option.id"> | ||
| <kbq-option [value]="option"> |
There was a problem hiding this comment.
Ошибка все равно воспроизводится: https://koobiq-next--prs-1847-hsycrq0f.web.app/ru/components/select/examples#%D0%BF%D0%BE%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%87%D0%BD%D0%B0%D1%8F-%D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B0
Открыть, в поиске ввести 40
Выбрать опцию
Открыть выпадашку снова - Выбор вернется на элемент "#0"
There was a problem hiding this comment.
Pull request overview
This PR updates KbqSelect to avoid resetting the user’s current active (highlighted) option when new options are appended while the panel is open (e.g., infinite paging), and updates docs examples + tests to cover asynchronous option loading with preselected values.
Changes:
- Adjust select’s key-manager activation logic to keep the active item stable during option list appends while open, and to avoid search-triggered highlight changes while the panel is still closed.
- Update select paging/loading docs examples to use object values with
compareWith,showPreselectedValues, andvirtualOptionFactory(viaKbqVirtualOption). - Add unit tests covering async option paging behavior and the “search emits while panel is closed” regression scenario.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/docs-examples/components/select/select-paging/select-paging-example.ts | Updates paging example to bind option objects and enable virtual preselected rendering for unloaded pages. |
| packages/docs-examples/components/select/select-paging-error/select-paging-error-example.ts | Same as paging example, but for the error-flow paging scenario. |
| packages/docs-examples/components/select/select-loading/select-loading-example.ts | Updates loading example to support preselected virtual values and object-valued options. |
| packages/components/select/select.component.ts | Prevents active option highlight from being reset on appended option chunks while the panel is open; refactors stale-active-item check. |
| packages/components/select/select.component.spec.ts | Adds test coverage for async paging append behavior and search emissions while the panel is closed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** Whether the key manager's active item is missing from the current options list. */ | ||
| private isActiveItemStale(): boolean { | ||
| const activeItem = this.keyManager.activeItem as KbqOption | null; | ||
|
|
||
| return !activeItem || !this.options.toArray().includes(activeItem); | ||
| } |
No description provided.