Skip to content

fix(select): reset FormControl after clear (#DS-5182)#1658

Merged
NikGurev merged 1 commit into
mainfrom
bugfix/DS-5182
Jun 29, 2026
Merged

fix(select): reset FormControl after clear (#DS-5182)#1658
NikGurev merged 1 commit into
mainfrom
bugfix/DS-5182

Conversation

@NikGurev

Copy link
Copy Markdown
Contributor

При исследовании inline-edit обнаружено, что после очистки kbq-select через kbq-cleaner значение FormControl не обновлялось.

clearValue вызывал selectionModel.clear(false), что пропускало _emitChangeEvent — единственное место, где CDK сбрасывает кеш _selected.
В итоге, propagateChanges читал устаревший кеш через this.selected → selectionModel.selected и записывал старые значения обратно в FormControl.

Исправление: clear(false) → clear().

Добавлены тесты, проверяющие control.value после клика по cleaner.

До После
https://github.com/user-attachments/assets/049937d6-fa2d-4f4c-bcc7-b01721be1ca4 https://github.com/user-attachments/assets/61d8d601-67a0-482a-a558-2e34572c05c8

@NikGurev NikGurev self-assigned this Jun 24, 2026
@NikGurev NikGurev added bug Something isn't working 20.x labels Jun 24, 2026
@artembelik artembelik requested a review from Copilot June 24, 2026 13:02
@github-actions

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit fdabc57):

https://koobiq-next--prs-1658-k7th04gk.web.app

(expires Mon, 29 Jun 2026 13:03:31 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an issue in KbqSelect where clearing the value via kbq-cleaner didn’t correctly reset the bound FormControl, due to SelectionModel not emitting change events (leaving stale internal selection cache).

Changes:

  • Updated clearValue to call selectionModel.clear() (emit changes) instead of clear(false) so the internal selected cache is properly reset.
  • Added unit tests to assert FormControl.value updates after clicking the cleaner for both single- and multi-select.
  • Added a visual-selection regression test for multi-select to ensure options are deselected in the panel after clear.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/components/select/select.component.ts Ensures clear action emits selection-model change events so clearing actually propagates to forms.
packages/components/select/select.component.spec.ts Adds regression coverage for FormControl updates and visual deselection after using the cleaner.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/components/select/select.component.spec.ts
@NikGurev NikGurev merged commit 18ea72f into main Jun 29, 2026
10 checks passed
@NikGurev NikGurev deleted the bugfix/DS-5182 branch June 29, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

20.x bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants