flow
flow copied to clipboard
[Grid] lazy loading refreshItem will pass PageSize = Integer.MAX_VALUE
Description of the bug
in grid using lazy data loading, when we call method GridLazyDataView.refreshItem(data)
. it will call the callback method fetchCallback
of public V setItems( com.vaadin.flow.data.provider.CallbackDataProvider.FetchCallback<T, F> fetchCallback )
with q.getPageSize = Integer.MAX_VALUE -> will load huge data.
This causes program very slow. see below code for detailed bug.

Expected behavior
getPageSize = configurable. Default = 50.
Also ensure when call refreshItem
will not change current position of the edited item in the grid.
Minimal reproducible example
N/A
Versions
- Vaadin / Flow version: 23
- Java version: 17
- OS version: N/A
- Browser version (if applicable):N/A
- Application Server (if applicable):N/A
- IDE (if applicable):N/A
@letrthang I could not find the codes from your screenshots neither in GridLazyDataView
nor AbstractLazyDataView
.
Also, I couldn't find loading all of the items in the lazy-loading related classes. Am I missing something? If so, would you please refer to the actual code in the flow or flow-components repository (instead of screenshots) which you think is the source of this bug?
@letrthang I could not find the codes from your screenshots neither in
GridLazyDataView
norAbstractLazyDataView
. Also, I couldn't find loading all of the items in the lazy-loading related classes. Am I missing something? If so, would you please refer to the actual code in the flow or flow-components repository (instead of screenshots) which you think is the source of this bug?
@taefi it is Vaadin flow code. AbstractLazyDataView -> AbstractDataView.
package com.vaadin.flow.data.provider;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.ComponentEventListener;
import com.vaadin.flow.component.ComponentUtil;
import com.vaadin.flow.function.SerializableSupplier;
import com.vaadin.flow.shared.Registration;
import java.util.Objects;
import java.util.stream.Stream;
public abstract class AbstractDataView<T> implements DataView<T> {
protected static final String NULL_ITEM_ERROR_MESSAGE = "Item cannot be null";
protected static final String NULL_IDENTIFIER_ERROR_MESSAGE = "Identity provider should not return null";
protected SerializableSupplier<? extends DataProvider<T, ?>> dataProviderSupplier;
protected Component component;
public void refreshItem(T item) {
Objects.requireNonNull(item, "Item cannot be null");
this.getItems().filter((i) -> {
return this.equals(item, i);
}).findFirst().ifPresent((i) -> {
((DataProvider)this.dataProviderSupplier.get()).refreshItem(item);
});
}
refer: https://github.com/vaadin/flow/issues/14171