Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not trigger data communicator reset when no filters (#6712) (CP: 24.4) #6716

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1445,8 +1445,10 @@ public UpdateQueueData getUpdateQueueData() {

private SerializableFunction<T, String> classNameGenerator = item -> null;
private SerializableFunction<T, String> partNameGenerator = item -> null;
private SerializablePredicate<T> dropFilter = item -> true;
private SerializablePredicate<T> dragFilter = item -> true;
private SerializablePredicate<T> defaultDropFilter = item -> true;
private SerializablePredicate<T> defaultDragFilter = item -> true;
private SerializablePredicate<T> dropFilter = defaultDropFilter;
private SerializablePredicate<T> dragFilter = defaultDragFilter;
private Map<String, SerializableFunction<T, String>> dragDataGenerators = new HashMap<>();

private Registration dataProviderChangeRegistration;
Expand Down Expand Up @@ -4527,7 +4529,15 @@ public Registration addDragEndListener(
public void setDropMode(GridDropMode dropMode) {
getElement().setProperty("dropMode",
dropMode == null ? null : dropMode.getClientName());
getDataCommunicator().reset();

// Do not reset the data communicator if no filters are applied in order
// to avoid unnecessary scroll position reset. This can be removed when
// Flow will provide a way to request refresh for only items that
// are in the viewport.
if (dragFilter != defaultDragFilter
|| dropFilter != defaultDropFilter) {
getDataCommunicator().reset();
}
}

/**
Expand All @@ -4552,7 +4562,15 @@ public GridDropMode getDropMode() {
*/
public void setRowsDraggable(boolean rowsDraggable) {
getElement().setProperty("rowsDraggable", rowsDraggable);
getDataCommunicator().reset();

// Do not reset the data communicator if no filters are applied in order
// to avoid unnecessary scroll position reset. This can be removed when
// Flow will provide a way to request refresh for only items that
// are in the viewport.
if (dragFilter != defaultDragFilter
|| dropFilter != defaultDropFilter) {
getDataCommunicator().reset();
}
}

/**
Expand Down