Skip to content

refactor: simplify multi-select-combo-box updating chips logic#11295

Merged
web-padawan merged 1 commit intomainfrom
refactor/mscb-simplify-update-chips
Mar 10, 2026
Merged

refactor: simplify multi-select-combo-box updating chips logic#11295
web-padawan merged 1 commit intomainfrom
refactor/mscb-simplify-update-chips

Conversation

@web-padawan
Copy link
Copy Markdown
Member

Summary

  • Extract autoExpandVertically into an early return path, avoiding all width measurement logic
  • Split horizontal-expand and default chip strategies into dedicated __updateChipsHorizontalExpand and __updateChipsDefault methods
  • Replace O(n²) backward iteration + unshift with forward iteration + map in horizontal-expand path
  • Cache __getOverflowWidth() before the while loop instead of calling it per iteration
  • Extract __getWrapperWidth() helper for repeated this._inputField.$.wrapper.clientWidth access
  • Add early return for empty selectedItems to skip style computations
  • Move remainingWidth/chipMinWidth computation into each helper so they only compute what they need
  • Remove unnecessary [...this.selectedItems] array copy since items are no longer mutated

Test plan

  • All 247 existing multi-select-combo-box tests pass (yarn test --group multi-select-combo-box)

🤖 Generated with Claude Code

@web-padawan web-padawan changed the title refactor: simplify multi-select-combo-box __updateChips method refactor: simplify multi-select-combo-box updating chips logic Mar 9, 2026
- Extract autoExpandVertically into early return path without overflow logic
- Split horizontal-expand and default chip strategies into separate methods
- Replace O(n²) backward iteration + unshift with forward iteration + map
- Cache __getOverflowWidth() before loop instead of calling per iteration
- Extract __getWrapperWidth() helper for repeated wrapper width access
- Add early return for empty selectedItems to skip style computations
- Move remainingWidth/chipMinWidth computation into each helper method
- Remove unnecessary selectedItems array copy since items are no longer mutated

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@web-padawan web-padawan force-pushed the refactor/mscb-simplify-update-chips branch from 4a0b6bc to 69823a1 Compare March 9, 2026 15:04
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 9, 2026

@web-padawan web-padawan removed the request for review from tomivirkki March 10, 2026 09:12
@web-padawan web-padawan merged commit 5831f68 into main Mar 10, 2026
10 checks passed
@web-padawan web-padawan deleted the refactor/mscb-simplify-update-chips branch March 10, 2026 09:12
vaadin-bot pushed a commit that referenced this pull request Mar 10, 2026
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
vaadin-bot pushed a commit that referenced this pull request Mar 10, 2026
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@vaadin-bot
Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.1.0-beta3.

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.

3 participants