Repository navigation
feat: add waitForLoadingFinished to ComboBoxElement - #10189
Conversation
vaadin-review-bot
left a comment
There was a problem hiding this comment.
Reviewed the changes — left 2 comments.
| Finding | |
|---|---|
| 📝 | getOptions() still returns empty labels for placeholder items once the data set exceeds one page, so the new doc line promises more than it delivers |
| 🧪 | Nothing would fail if the new wait in getOptions() were removed again |
|
|
||
| /** | ||
| * Gets a list of all available options. | ||
| * Gets a list of all available options. Opens the popup and waits until the |
There was a problem hiding this comment.
📝 getOptions() still returns empty labels for placeholder items once the data set exceeds one page, so the new doc line promises more than it delivers
loading only reflects pending page requests. For a lazy combo box, filteredItems is sized to size and the indexes outside the loaded pages hold ComboBoxPlaceholder, whose label resolves to ''. With the 250-item combo box in ComboBoxListDataViewPage, getOptions() returns 250 entries of which 200 are empty strings, and the new wait changes nothing about that.
"Gets a list of all available options ... waits until the items have finished loading" reads as a completeness guarantee. MultiSelectComboBoxElement.getOptions() words the same behavior accurately ("gets the labels of the items that are currently loaded in the popup") — worth aligning with it.
ComboBoxElement.java:131 · documentation
There was a problem hiding this comment.
Updated JavaDoc to mention the limitation and be more aligned with MultiSelectComboBoxElement.
| @SuppressWarnings("unchecked") | ||
| public List<String> getOptions() { | ||
| openPopup(); | ||
| waitForLoadingFinished(); |
There was a problem hiding this comment.
🧪 Nothing would fail if the new wait in getOptions() were removed again
All ComboBoxElement.getOptions() callers in the IT module either wrap the call in their own waitUntil (DataProviderIT, RefreshDataProviderIT.emptyComboBox_addItemsAndRefreshAll_addedItemsIncluded) or depend on timing (RefreshDataProviderIT.refreshItem_onlyOneItemUpdated, which would only flake, not fail). The one behavior this PR adds to getOptions() — open a data-provider combo box and read real labels without an outer wait — has no test that pins it.
ComboBoxElement.java:139 · tests
There was a problem hiding this comment.
Removed this line and reverted IT change to keep this PR about new API only, without behavior change.
Tests that wait for a lazy combo box repeated the same polling on the loading property. The method makes that wait part of the element API, like the one MultiSelectComboBoxElement already provides. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
10a9917 to
302005e
Compare
|
sissbruecker
left a comment
There was a problem hiding this comment.
IMO we can use this in getOptions, I would dismiss the review bot comment.
Sounds good to me, but let me create a separate PR for that. |
|
This ticket/PR has been released with Vaadin 25.4.0-alpha1. |



Description
Related to #10141
The new method does not change
getOptions(). TestBench callswaitForVaadin()before its element commands, so the request that loads the first page has already finished whenfilteredItemsis read. A combo box whose data provider sleeps 500 ms returns its labels with and without an explicit wait, so the method does not need one. The wait is useful where a test drives the combo box itself, which is why it becomes part of the element API.waitForLoadingFinished()toComboBoxElement, matching the methodMultiSelectComboBoxElementalready providessetFilter()to call the new method instead of waiting on theloadingproperty inlineAbstractComboBoxITandComboBoxListDataViewITto call the new method instead of polling theloadingpropertyType of change
Note
The
getOptions()Javadoc correction moved to #10190, so this branch no longer touches that method.