Repository navigation
fix: request pages asynchronously when scrolling - #4561
Conversation
c265b1e to
0afb763
Compare
| expect(dp.calledOnce).to.be.true; | ||
| }); | ||
|
|
||
| it('should request pages asynchronously when scrolling', async () => { |
web-padawan
left a comment
There was a problem hiding this comment.
LGTM if the Flow counterpart tests pass with this change (haven't tried it locally).
It would be nice to also have the test emulating the actual logic of the connector (e.g. filling filteredItems with placeholder instances). Not a blocker though.
I checked. There will be some failures but they all seem to be fixable by waiting for // vaadin-combo-box-flow-parent/vaadin-combo-box-flow-integration-tests/src/test/java/com/vaadin/flow/component/combobox/test/AbstractComboBoxIT.java
protected void scrollToItem(ComboBoxElement comboBox, int index) {
comboBox.openPopup();
executeScript("arguments[0]._scroller.scrollIntoView(arguments[1])",
comboBox, index);
+ // Wait for the data provider to pick up on pages that need
+ // to be loaded after scrolling.
+ getCommandExecutor().getDriver().executeAsyncScript(
+ "var callback = arguments[arguments.length - 1];"
+ + "requestAnimationFrame(callback)");
}
I was also thinking about that, but since we are planning to move that connector's logic into the web-components repo (#4568) in some form, I think we can add all the relevant tests then. |
9103f3a to
344d692
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
|
Hi @vursen , this commit cannot be picked to 23.2 by this bot, can you take a look and pick it manually? |
|
Hi @vursen , this commit cannot be picked to 23.1 by this bot, can you take a look and pick it manually? |
|
This ticket/PR has been released with Vaadin 23.3.0.alpha1 and is also targeting the upcoming stable 23.3.0 version. |








Description
This PR makes
combo-box-scrollerrequest a page asynchronously when it encounters an item placeholder while scrolling. This is needed to prevent an immediate page request and therefore a possible infinite recursion in case the data provider implements page request cancelation logic by invoking data provider page callbacks with an empty array. This is exactly the case for the Flow counterpart that clears page callbacks by invoking them with an empty array to prevent too many page requests when scrolling fast. Without the current change, the scroller could immediately re-request the canceled page which led to looping since the Flow's data provider could in turn try to clear page callbacks again and so on.Fixes vaadin/flow-components#3553
Type of change
Checklist