Skip to content

fix: update selectedItems when updating items - #4016

Merged
web-padawan merged 1 commit into
masterfrom
fix/reset-selected-items
Jun 9, 2022
Merged

web-padawan merged 1 commit into
masterfrom
fix/reset-selected-items

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Description

Currently, when updating items property to empty array, or changing it, the selectedItems is not updated.
This PR changes that to filter out the items that are removed and exclude them from selectedItems.

Type of change

  • Bugfix

@web-padawan
web-padawan requested a review from vursen June 9, 2022 10:46
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2022

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@web-padawan
web-padawan merged commit 0064ec4 into master Jun 9, 2022
@web-padawan
web-padawan deleted the fix/reset-selected-items branch June 9, 2022 10:52
@tomivirkki

Copy link
Copy Markdown
Member

Hmm...I wonder if this is expected

@tomivirkki

Copy link
Copy Markdown
Member

I mean at least in grid, you could mark certain items as selected even before populating the items. Once the selected items get included in items, they just show as selected.

@web-padawan

Copy link
Copy Markdown
Member Author

Good point, I did not consider the grid behavior. Maybe we should revert this PR then?

@tomivirkki

Copy link
Copy Markdown
Member

Also with the following case <vaadin-multi-select-combo-box .items="${this.items}" .selectedItems=${this.selectedItems}> the selectedItems may get received (from the server) first and items could get assigned a temporary value of []. Once the actual items is received, this logic may have already emptied the selectedItems value.

@web-padawan

Copy link
Copy Markdown
Member Author

Sounds good to me. Submitted a PR to revert this, sorry about the hassle #4018

web-padawan added a commit that referenced this pull request Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants